add scripts/pkgfile.js

Signed-off-by: andy.lee <andy.lee@suse.com>
This commit is contained in:
andy.lee 2025-01-06 16:29:41 +08:00
parent bbbdd1a881
commit 259988f230
No known key found for this signature in database
GPG Key ID: 10911689462678C7

24
scripts/pkgfile.js Normal file
View File

@ -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));