Make sure set-homepage script is treated as a commonjs script

This commit is contained in:
Alejandro Celaya
2023-12-18 23:12:51 +01:00
parent 8907ea5310
commit 683c049a23
2 changed files with 1 additions and 1 deletions

13
scripts/set-homepage.cjs Normal file
View File

@@ -0,0 +1,13 @@
const argv = process.argv.slice(2);
const [ homepage ] = argv;
if (!homepage) {
throw new Error('Homepage has to be provided as the first arg for this script');
}
const packageJsonPath = `${__dirname}/../package.json`;
const packageJson = require(packageJsonPath);
const fs = require('fs');
packageJson.homepage = homepage;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));