-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run buildAll in prepare, move husky install to postinstall #1583
base: master
Are you sure you want to change the base?
Run buildAll in prepare, move husky install to postinstall #1583
Conversation
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.
|
/easycla |
I may just not understand how these things work, but I'd have guessed |
yeah, that does seem possible, I'll test some more to see what's up. The docs around lifecycle scripts are confusing and, I strongly suspect, inaccurate (and the code isn't straightforward either). I'll test more and find a hook that works. FWIW the docs
|
Finally got around to testing this, results in https://github.com/schleyfox/schleyfox-npm-lifecycle-test npm install in the package dir (for e.g. development) runs
while npm install in another app pulling the dependency from npm runs
install of a git dependency runs
(I think that is an install (which includes prepare) followed by a bare prepare (no pre- or post-) followed by an npm-install-as-a-dependency (with pre- and post-) npm publish runs
I think this indicates that |
@schleyfox i sort of lost track of this one -- looks like there might be one more todo here? |
This is part of a series of PRs based on performance work we have done to
improve a use-case involving parsing/formatting hundreds of thousands of dates
where luxon was the bottleneck.
This is just an improvement to make it possible to use luxon as a git dependency (for instance when you're testing out a bunch of hopefully good changes on your fork).
Husky adds git hooks into the repo. We want the dev experience of
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 runningnpm 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.