Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion studio/apps/web-react/vite/PublishApiHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export class PublishApiHandler {
if (error instanceof Error && /not found/.test(error.message)) {
return { status: 404, body: { error: error.message } };
}
return { status: 500, body: { error: 'La création de la proposition a échoué.' } };
const detail = error instanceof Error ? ` ${error.message}` : '';
return {
status: 500,
body: { error: `La création de la proposition a échoué.${detail}` },
};
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execFile } from 'node:child_process';
import { cp, mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises';
import { cp, mkdtemp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { promisify } from 'node:util';
Expand Down Expand Up @@ -41,7 +41,7 @@ export class GitProductionGameDataProposalGateway implements ProductionGameDataP
join(worktreePath, internalCatalogPath),
{ recursive: true },
);
await this.npm(['version', 'patch', '--no-git-tag-version'], worktreePath);
await this.bumpPatchVersion(worktreePath);
await this.git([
'-C',
worktreePath,
Expand Down Expand Up @@ -78,8 +78,31 @@ export class GitProductionGameDataProposalGateway implements ProductionGameDataP
await executeFile('git', args, { cwd: this.repositoryPath });
}

private async npm(args: readonly string[], cwd: string): Promise<void> {
const executable = process.platform === 'win32' ? 'npm.cmd' : 'npm';
await executeFile(executable, args, { cwd });
private async bumpPatchVersion(worktreePath: string): Promise<void> {
const packagePath = join(worktreePath, 'package.json');
const lockPath = join(worktreePath, 'package-lock.json');
const packageDocument = JSON.parse(await readFile(packagePath, 'utf8')) as {
version: string;
};
const lockDocument = JSON.parse(await readFile(lockPath, 'utf8')) as {
version: string;
packages: Record<string, { version?: string }>;
};
const versionParts = packageDocument.version.split('.').map(Number);
if (
versionParts.length !== 3
|| versionParts.some((part) => !Number.isInteger(part) || part < 0)
) {
throw new Error(`Unsupported package version '${packageDocument.version}'.`);
}
const nextVersion = `${versionParts[0]}.${versionParts[1]}.${versionParts[2] + 1}`;
packageDocument.version = nextVersion;
lockDocument.version = nextVersion;
lockDocument.packages[''] ??= {};
lockDocument.packages[''].version = nextVersion;
await Promise.all([
writeFile(packagePath, `${JSON.stringify(packageDocument, null, 2)}\n`, 'utf8'),
writeFile(lockPath, `${JSON.stringify(lockDocument, null, 2)}\n`, 'utf8'),
]);
}
}
34 changes: 34 additions & 0 deletions studio/store/catalog/commanders.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,39 @@
],
"freeRecruitThreshold": 20
}
},
{
"id": "Erwan",
"name": "Erwan",
"description": "aucune",
"icon": "aucune",
"baseStats": {
"pawnMax": 45,
"health": 99,
"maxDefenseLevel": 2,
"wallVisualSet": "default",
"defensePowerPerLevel": 8,
"pawnDefinitionIdByColor": {
"red": "Aegis-soldier-melee-red",
"blue": "Aegis-soldier-melee-blue",
"green": "Aegis-soldier-melee-green"
},
"commanderPawnDefinitionIds": [
"commander-1-1"
],
"officerPawnDefinitionIds": [
"Aegis_officer_1",
"Aegis_officer_2",
"Aegis_officer_4"
],
"movementsPerTurn": 3,
"skills": [
"free-recruits",
"destroy-defense-pawns",
"expand-pawn-capacity",
"tactical-demolition"
],
"freeRecruitThreshold": 20
}
}
]