Skip to content

Commit 87fd3ff

Browse files
committed
Run buildAll in prepare, move husky install to postinstall
Husky adds git hooks into the repo. We want the dev experience of $ git clone remote/luxon $ npm install # installs husky hooks $ ...develop develop develop... $ git commit _lint runs, everything works_ We also want to build luxon when we call npm pack or npm publish. We also want to build luxon when it is installed somewhere else as a git dependency (https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies) Git dependencies work by running `npm install` from GitFetcher and then depend on DirFetcher running `npm prepare` (but only prepare, not prepack or postpack) This change moves `husky install` to postinstall (which will, unfortunately, still pointlessly run when we install luxon as a git dependency). It moves the buildAll to prepare from prepack so that the build happens when installed as a git dependency. This should preserve existing behavior while enabling installation from git. When installing from git and/or in CI environments, the husky command is sometimes not available in postinstall or is available but bails out when not run in the context of a git repo.
1 parent 3125686 commit 87fd3ff

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"format-check": "prettier --check 'src/**/*.js' 'test/**/*.js' 'benchmarks/*.js'",
2929
"benchmark": "node benchmarks/index.js",
3030
"codecov": "codecov",
31-
"prepack": "babel-node tasks/buildAll.js",
32-
"prepare": "husky install",
31+
"postinstall": "husky install || exit 0",
32+
"prepare": "babel-node tasks/buildAll.js",
3333
"show-site": "http-server build"
3434
},
3535
"lint-staged": {

0 commit comments

Comments
 (0)