-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fixed: npm publish lifecycle order #2636
Conversation
The lifecycle order for `npm publish` was corrected to match actual behavior and no longer contradicts the description for prepare .
This change needs to be backported as well! |
We may need to take a slightly closer look at this, because unless I'm missing something |
@wraithgar Do something very simple. In your
and run: npm publish . --dry-run |
|
What version of npm are you using? ~/D/n/foo $ npm publish . --loglevel silent --dry-run
> [email protected] prepublishOnly
> echo prepublishOnly
prepublishOnly
~/D/n/foo $ npm -v
7.5.2
~/D/n/foo $ cat package.json|json scripts
{
"prepublish": "echo prepublish",
"prepublishOnly": "echo prepublishOnly",
"prepare": "echo prepare"
} |
@wraithgar I am on 6.14.10 (shipped with node 14.15.4). That explains the difference we are seeing, (except it doesn't solve the matter but actually makes things worse, see below)! output with 6.14.10
output with 7.5.2
Note that |
Prepare runs, but its output is suppressed, and it doesn't run during a dry-run. We did a quick spike to investigate and document the lifecycle scripts, and the initial research is done. Now all that's left is getting the docs up to date to reflect reality, and reflect all of it. |
Saving you a click, here's what runs during publish
|
Just to confirm, in that order? because it is different from 6.x? |
Yes this is the order in which lifecycle events happen during publish in npm@7 |
This change and many other is going to be reflected in #2690 |
The lifecycle order for
npm publish
was corrected to match actual behavior and no longer contradicts the description for prepare .