Add CI scripts and workflow for forgejo
This commit is contained in:
parent
ee99ab15dd
commit
9c95e4b1f6
6 changed files with 262 additions and 56 deletions
|
|
@ -1,35 +1,46 @@
|
|||
/*
|
||||
The intent of this script is to do all of the modifications of the manifest file
|
||||
that we need to do in order to release the package. This can include removing
|
||||
dev-only fields/attributes that end users will never, and should never, care
|
||||
about nor need.
|
||||
The intent of this script is to do all of the modifications of the
|
||||
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";
|
||||
|
||||
const MANIFEST_PATH = `module.json`;
|
||||
|
||||
const {
|
||||
DOWNLOAD_URL,
|
||||
LATEST_URL,
|
||||
} = process.env;
|
||||
|
||||
let manifest;
|
||||
try {
|
||||
manifest = JSON.parse(await readFile(MANIFEST_PATH, `utf-8`));
|
||||
console.log(`Manifest loaded from disk`);
|
||||
} catch {
|
||||
console.error(`Failed to parse manifest file.`);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
console.log(`Updating download/manifest URLs`);
|
||||
manifest.download = DOWNLOAD_URL;
|
||||
manifest.manifest = LATEST_URL;
|
||||
|
||||
// Filter out dev-only resources
|
||||
if (manifest.esmodules) {
|
||||
console.log(`Removing dev-only esmodules`);
|
||||
manifest.esmodules = manifest.esmodules.filter(
|
||||
filepath => !filepath.startsWith(`dev/`)
|
||||
);
|
||||
};
|
||||
|
||||
// Remove dev flags
|
||||
console.log(`Cleaning up flags`);
|
||||
delete manifest.flags?.hotReload;
|
||||
delete manifest.flags?.inDev;
|
||||
|
||||
if (Object.keys(manifest.flags).length === 0) {
|
||||
delete manifest.flags;
|
||||
};
|
||||
|
||||
await writeFile(MANIFEST_PATH, JSON.stringify(manifest, undefined, `\t`));
|
||||
console.log(`Manifest written back to disk`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue