From e8baec0bc4d98ca8689b2265581e50cfcae799e7 Mon Sep 17 00:00:00 2001 From: Eldritch-Oliver Date: Sat, 11 Oct 2025 17:19:03 -0600 Subject: [PATCH] Implement the script that handles preparing the manifest for release --- scripts/prepareManifest.mjs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/scripts/prepareManifest.mjs b/scripts/prepareManifest.mjs index ec0ed06..bfdbfba 100644 --- a/scripts/prepareManifest.mjs +++ b/scripts/prepareManifest.mjs @@ -4,11 +4,31 @@ manifest file that we need to do in order to release the system. This can include removing dev-only fields/attributes that end users will never, and should never, care about nor need. */ +import { readFile, writeFile } from "fs/promises"; -// TODO: load the manifest +const MANIFEST_PATH = `system.json`; -// TODO: remove all files that start with dev/ from the esmodules list +let manifest; +try { + manifest = JSON.parse(await readFile(MANIFEST_PATH, `utf-8`)); +} catch { + console.error(`Failed to parse manifest file.`); + process.exit(1); +}; -// TODO: remove flags.hotReload -// TODO: write the new manifest to disk +// Filter out dev-only resources +if (manifest.esmodules) { + manifest.esmodules = manifest.esmodules.filter( + filepath => !filepath.startsWith(`dev/`) + ); +}; + +// Remove dev flags +delete manifest.flags?.hotReload; + +if (Object.keys(manifest.flags).length === 0) { + delete manifest.flags; +}; + +await writeFile(MANIFEST_PATH, JSON.stringify(manifest, undefined, `\t`));