Fix Windows artifact naming in desktop packaging

- Fix the naming convention in Electron output to align with previous
  artifact naming to not break external/internal URLs.
- In desktop execution tests, make artifact locator logic stricter to
  test regression.
This commit is contained in:
undergroundwires
2023-08-30 13:34:30 +02:00
parent ad0576a752
commit f4d86fccfd
9 changed files with 95 additions and 53 deletions

View File

@@ -64,15 +64,22 @@ export async function npmBuild(
}
}
const appNameCache = new Map<string, string>();
export async function getAppName(projectDir: string): Promise<string> {
if (!projectDir) { throw new Error('missing project directory'); }
if (appNameCache.has(projectDir)) {
return appNameCache.get(projectDir);
}
const packageData = await readPackageJsonContents(projectDir);
try {
const packageJson = JSON.parse(packageData);
if (!packageJson.name) {
const name = packageJson.name as string;
if (!name) {
return die(`The \`package.json\` file doesn't specify a name: ${packageData}`);
}
return packageJson.name;
appNameCache.set(projectDir, name);
return name;
} catch (error) {
return die(`Unable to parse \`package.json\`. Error: ${error}\nContent: ${packageData}`);
}