Skip to content

Commit

Permalink
fix: only run postinstall scripts in non- prod-mode (#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenbroekema committed Jan 26, 2024
1 parent 0e0dd46 commit cd48aac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-shirts-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Only run postinstall scripts when NODE_ENV isn't production (e.g. npm install --production or --omit=dev). To avoid errors running husky/patch-package.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
"serve-docs": "docsify serve docs -p 3000 -P 12345",
"install-cli": "npm install -g $(npm pack)",
"release": "node scripts/inject-version.js && tsc --emitDeclarationOnly && changeset publish",
"prepare": "husky install",
"postinstall": "patch-package"
"postinstall": "node scripts/postinstall-dev.cjs"
},
"lint-staged": {
"*.js": [
Expand Down
5 changes: 5 additions & 0 deletions scripts/postinstall-dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if (process.env.NODE_ENV !== 'production') {
const husky = require('husky');
husky.install();
require('patch-package');
}

0 comments on commit cd48aac

Please sign in to comment.