diff --git a/scripts/run.ts b/scripts/run.ts index 2b6f336b2..32cad24e6 100644 --- a/scripts/run.ts +++ b/scripts/run.ts @@ -138,6 +138,9 @@ function build(args: BuildArgs): void { run(`react-scripts build && cp -r i18n icon.png build`); run(`d2-manifest package.json build/manifest.webapp -t ${manifestType} -n '${variant.title}'`); + if (variant.file === "metadata-synchronization") { + updateManifestJsonFile(`build/manifest.json`, variant.title); + } updateManifestNamespace(`build/manifest.webapp`, variant.file); run(`rm -f ${fileName}`); run(`cd build && zip -r ../${fileName} *`); @@ -153,6 +156,14 @@ function updateManifestNamespace(manifestPath: string, variantFile: string) { } } +function updateManifestJsonFile(manifestJsonPath: string, variantTitle: string) { + if (fs.existsSync(manifestJsonPath)) { + const manifestJson = JSON.parse(fs.readFileSync(manifestJsonPath, "utf8")); + Object.assign(manifestJson, { name: variantTitle, short_name: variantTitle }); + fs.writeFileSync(manifestJsonPath, JSON.stringify(manifestJson, null, 2)); + } +} + /* Start server */ type StartServerArgs = { variant: string; port: number; verbose: boolean };