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

[BUG] Undocumented (?) change in prepublishOnly/prepare behavior in v7 #2668

Closed
Conduitry opened this issue Feb 11, 2021 · 1 comment
Closed
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@Conduitry
Copy link

Conduitry commented Feb 11, 2021

Current Behavior:

If there are both prepare and prepublishOnly scripts, then npm publish runs them in a different order in v7 than it did in v6.

Expected Behavior:

v7 should run these in the same order as v6, or this difference should be documented somewhere.

Steps To Reproduce:

  1. In an empty directory, create a package.json containing:
{
        "name": "test",
        "version": "0.0.0",
        "scripts": {
                "prepare": "echo prepare >> scripts.log",
                "prepublishOnly": "echo prepublishOnly >> scripts.log"
        }
}
  1. Run npm publish (aborting out of 2FA prompt, etc.)
  2. cat scripts.log

On [email protected], this file contains:

prepare
prepublishOnly

On [email protected], this file contains:

prepublishOnly
prepare

Is this an intended change or is it a bug? I didn't see anything in the 7.0.0 changelog about this, nor did I see any relevant differences between https://docs.npmjs.com/cli/v6/using-npm/scripts and https://docs.npmjs.com/cli/v7/using-npm/scripts.

Environment:

  • OS: Ubuntu 20.04
  • Node: 15.8.0
  • npm: 7.5.3
@Conduitry Conduitry added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 11, 2021
@wraithgar
Copy link
Member

Updating the scripts to reflect the new lifecycle is in our backlog now. npm/statusboard#267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants