Ensured branch slug is generated before building project on preview env deployment

This commit is contained in:
Alejandro Celaya
2021-05-09 13:53:36 +02:00
parent 9a245fbf13
commit f74270a767
2 changed files with 19 additions and 6 deletions

13
scripts/set-homepage.js 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));