-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Installing package from github URL doesn't trigger prepublish script #2875
Comments
Is there any updates? |
Technically speaking this is feature, not a bug, because this is not implemented in npm either. I would expect following: when dependency installed from git and there is prepublish hook, install dev dependencies for this repo and run hook. If there is no prepublish hook, no need to install dev dependencies, just git clone. |
More info here: - npm/npm#3055 - yarnpkg/yarn#2875
More info here: - npm/npm#3055 - yarnpkg/yarn#2875
More info here: - npm/npm#3055 - yarnpkg/yarn#2875
There was a suggestion on npm from @gagern:
It was not implemented because the npm code was too complex at that time. I think this behavior can be implemented in Yarn, either as the default behavior, or with an option somewhere. I'll have a look to prepare a PR for that. |
Update:
|
Please let me know if y'all have any questions about how this works in npm now, and please note that it's fairly fresh and it's bound to have some kind of crap in there that I didn't realize would be a problem (and thus subject to change -- so if you find something, please let us know!) The code in question npm-side is: https://github.com/npm/npm/blob/latest/lib/pack.js#L151-L221, which isn't exactly the simplest thing in the world. It essentially runs There's another backflip that happens where this function is actually passed to pacote, which invokes it when installing git dependencies. This was mainly so pacote didn't have to be aware of lifecycle scripts, and I assume will be simplified in the future (or have more of this be integrated into pacote proper). |
We switch from yarn to npm because we’re installing `node-tail` from GitHub (in order to pick up lucagrulla/node-tail#63 and lucagrulla/node-tail#64), and this means that we need to build it on installation (via the “prepare” script that lucagrulla/node-tail#64 added), and yarn 0.24.6 doesn’t run “prepare” scripts when installing from GitHub: yarnpkg/yarn#2875. That’s fixed in a more recent release of yarn but given that we’re about to switch back to npm anyway, npm is simpler. Refs #5.
Do you want to request a feature or report a bug?
Bug/feature
What is the current behavior?
Installing package from Github URL doesn't run the prepublish script
What is the expected behavior?
Yarn should run the
prepublish
script when installing from a Github URL just like it should when installing a local package.Ref: npm/npm#3055
More specifically: npm/npm#3055 (comment)
The text was updated successfully, but these errors were encountered: