Skip to content

Commit 9d3e749

Browse files
authored
feat(prepare.js): add script to install husky only if NODE_ENV is not 'CI' (danny-avila#512)
refactor(package.json): change prepare script to run prepare.js script instead of husky install directly
1 parent 2003480 commit 9d3e749

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

config/prepare.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { exec } = require('child_process');
2+
3+
if (process.env.NODE_ENV !== 'CI') {
4+
exec('npx husky install', (error, stdout, stderr) => {
5+
if (error) {
6+
console.error(`exec error: ${error}`);
7+
return;
8+
}
9+
console.log(`stdout: ${stdout}`);
10+
console.error(`stderr: ${stderr}`);
11+
});
12+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"test:api": "cd api && npm run test",
2222
"e2e:update": "playwright test --config=e2e/playwright.config.js --update-snapshots",
2323
"e2e:report": "npx playwright show-report e2e/playwright-report",
24-
"prepare": "test \"$NODE_ENV\" != \"CI\" && husky install",
24+
"prepare": "node config/prepare.js",
2525
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\""
2626
},
2727
"repository": {

0 commit comments

Comments
 (0)