-
Notifications
You must be signed in to change notification settings - Fork 44
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
[BUG] prepack
is not called on installation of git packages
#257
Comments
We were actually considering adding a prepack script to TypeScript so that people could install via git for bisect purposes, but found out that it doesn't actually work in npm v7+. prepack has better semantics (doesn't run on a plain dep install in the repo) and works cross-package-manager, but not having this is really a bummer and we've ended up not actually adding it. |
Also/still a problem on npm 10.2.0. A very silly workaround: In the consuming package (i.e. the one that has the git dependency):
Since the n.b. I don't know if 9.0.0 is the right version to start with, just guessing from the issue description. |
If you hadn't seen it, there's also: https://github.com/cspotcode/workaround-broken-npm-prepack-behavior Which is what |
Is there an existing issue for this?
Current Behavior
The npm CLI documentation says that
prepack
"Runs BEFORE a tarball is packed (on "npm pack", "npm publish", and when installing a git dependencies)," yet in dir.js L39-L41, it's made clear that pacote expects the CLI to call it, rather than pacote itself.Expected Behavior
Unless I am misunderstanding the control flow here,
npm
calls pacote before ever having access to the git repo's files, and doesn't receive control flow back until after the tarball has already been generated (and installed?). If that's the case, the calling ofprepack
when downloading a git repository needs to be done by pacote, rather than expecting the CLI to call it.Notes:
prepare
andprepack
scripts are not handled as documented when installing a git dependency cli#1865) which tracks this issue, but has been closed due to repairation of half of the issue (dependency installation before prepare script).Steps To Reproduce
See this comment in npm/cli for a simple reproduction process.
Environment
The text was updated successfully, but these errors were encountered: