From 259988f23074acf4a560a983871837ba8e55753c Mon Sep 17 00:00:00 2001 From: "andy.lee" Date: Mon, 6 Jan 2025 16:29:41 +0800 Subject: [PATCH] add scripts/pkgfile.js Signed-off-by: andy.lee --- scripts/pkgfile.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/pkgfile.js diff --git a/scripts/pkgfile.js b/scripts/pkgfile.js new file mode 100644 index 00000000..051e8b9d --- /dev/null +++ b/scripts/pkgfile.js @@ -0,0 +1,24 @@ +const fs = require('fs'); + +console.log('Updating package file'); // eslint-disable-line no-console + +if (process.argv.length !== 3) { + console.error('No enough args'); // eslint-disable-line no-console + + return; +} + +const pkgFilepath = process.argv[process.argv.length - 1]; +const pkg = require(pkgFilepath); + +// Ensure we have the keys we need + +pkg.files = ['**/*']; +pkg.rancher = true; +pkg.main = `${ pkg.name }-${ pkg.version }.umd.min.js`; + +delete pkg.scripts; +delete pkg.browserslist; + + +fs.writeFileSync(pkgFilepath, JSON.stringify(pkg, null, 2));