Skip to content
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

Should work for npm run prepublish #1

Open
iclanzan opened this issue May 6, 2015 · 4 comments
Open

Should work for npm run prepublish #1

iclanzan opened this issue May 6, 2015 · 4 comments

Comments

@iclanzan
Copy link

iclanzan commented May 6, 2015

Right now in-publish returns false if ran from npm run prepublish. I think it should return true.

@sebastienbarre
Copy link

and probably from npm pack as well, since it triggers prepublish too. Granted, you would think npm pack would run prepack, and that you could use it to run the same code as prepublish does, but prepack is not triggered...

@iarna
Copy link
Owner

iarna commented May 16, 2015

@iclanzan: Your suggestion makes sense to me.
@sebastienbarre: Hmm, npm cache add too in that case. In so far as this is "not on install".

@iarna
Copy link
Owner

iarna commented May 16, 2015

@sebastienbarre So, things like prepublish and publish and postpublish in your package.json are something we call "lifecycle scripts". These are triggered by npm when its doing various tasks– not by specific command calls but by internal machinery being called. There's no pack lifecycle– it does very indirectly run the prepublish lifecycle, though there are other ways of hitting this code path. (npm pack is implemented as npm cache add . followed by copying the tarball out of the cache. Adding a local directory to the cache results in its prepublish being called prior to adding it, as you're essentially "publishing" it to your cache.)

@sebastienbarre
Copy link

Thanks for the clarification @iarna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants