Skip to content

Commit

Permalink
Merge pull request #955 from EyeSeeTea/feat/Install-multiple-metadata…
Browse files Browse the repository at this point in the history
…-sync-flavours-2

Feat/install multiple metadata sync flavours 2
  • Loading branch information
MiquelAdell authored Jun 6, 2024
2 parents 3958996 + 90afc68 commit d4c8784
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} *`);
Expand All @@ -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 };
Expand Down

0 comments on commit d4c8784

Please sign in to comment.