Skip to content

Commit d4c8784

Browse files
authored
Merge pull request #955 from EyeSeeTea/feat/Install-multiple-metadata-sync-flavours-2
Feat/install multiple metadata sync flavours 2
2 parents 3958996 + 90afc68 commit d4c8784

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scripts/run.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ function build(args: BuildArgs): void {
138138

139139
run(`react-scripts build && cp -r i18n icon.png build`);
140140
run(`d2-manifest package.json build/manifest.webapp -t ${manifestType} -n '${variant.title}'`);
141+
if (variant.file === "metadata-synchronization") {
142+
updateManifestJsonFile(`build/manifest.json`, variant.title);
143+
}
141144
updateManifestNamespace(`build/manifest.webapp`, variant.file);
142145
run(`rm -f ${fileName}`);
143146
run(`cd build && zip -r ../${fileName} *`);
@@ -153,6 +156,14 @@ function updateManifestNamespace(manifestPath: string, variantFile: string) {
153156
}
154157
}
155158

159+
function updateManifestJsonFile(manifestJsonPath: string, variantTitle: string) {
160+
if (fs.existsSync(manifestJsonPath)) {
161+
const manifestJson = JSON.parse(fs.readFileSync(manifestJsonPath, "utf8"));
162+
Object.assign(manifestJson, { name: variantTitle, short_name: variantTitle });
163+
fs.writeFileSync(manifestJsonPath, JSON.stringify(manifestJson, null, 2));
164+
}
165+
}
166+
156167
/* Start server */
157168

158169
type StartServerArgs = { variant: string; port: number; verbose: boolean };

0 commit comments

Comments
 (0)