-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] reconsider prepare lifecycle script? #2967
Comments
I believe I've solved this with a simple plugin, yarn-plugin-postinstall-dev. This should run only when the developers run |
With #3146 merged |
There are some errors in this script, but I modified it slightly and it can be used normally. node:events:371
throw er; // Unhandled 'error' event
^
Error: spawn yarn run postinstallDev ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn yarn run postinstallDev',
path: 'yarn run postinstallDev',
spawnargs: []
} |
@rxliuli Please create an issue on the repo as this is not the right place to report issues with it |
I agree with @typicode that Yarn's initiative to simplify and limit the number of lifecycle hooks is generally a good thing. I'd really appreciate some thoughts / feedback from the maintainers here! I'll be happy to come up with a PR if this request is accepted! |
To add a use case to this issue: we share git hooks among the team, which perform some important checks before commiting. In order to make these checks more watertight, it's best that it's not left up to the development to configure the hooks path. With NPM, we would use the |
I second this. It would be useful to bootstrap auth for our private package registries since the |
I like yarn, i like typia, i like to work with latest updates. Sadly typia needs prepare script and berry doesn't support it. So typia doesn't support berry. That makes me sad, because i cant stick up to latest version. Oh well, that is maybe just a +1 with an usage example from my side. |
As Yarn doesn't support the package.json "prepare" lifecycle hook. See: yarnpkg/berry#2967 https://typicode.github.io/husky/how-to.html#manual-setup
This is a bigger problem now that NPM has broken the See typicode/husky#1491 / typicode/pinst#23 / https://gist.github.com/djcsdy/2f5a287b3ba16f2a8f0312f45588e6ce TLDR; we really need a lifecycle script that only runs when running |
Hey there! I was wondering if the Yarn team has given any thought to this matter? |
Describe the user story
As a developer, I may need to run some development only postinstall script.
Describe the solution you'd like
Enable
prepare
script.Describe the drawbacks of your solution
I'm aware Yarn 2 tries to simplify and limit the number of lifecycle hooks. I think it's good a thing.
However, except with some tricks and AFAIK there's no way to have a development only
postinstall
script with Yarn 2.Describe alternatives you've considered
Since only
postinstall
can be used to run commands afteryarn
, I've created pinst as a way to disable it when a package is published (simulating a dev-only postinstall script).There's an example here:
https://typicode.github.io/husky/#/?id=yarn-2
The text was updated successfully, but these errors were encountered: