Implement the script that handles preparing the manifest for release

This commit is contained in:
Eldritch-Oliver 2025-10-11 17:19:03 -06:00
parent 165c24f32c
commit e8baec0bc4

View file

@ -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 can include removing dev-only fields/attributes that end users will
never, and should never, care about nor need. 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`));