Skip to content

Fixes issue with preversion script exposing the new updated package information instead of the currently existing one#51

Closed
luislobo wants to merge 2 commits into
npm:latestfrom
luislobo:fix-preversion-package-json
Closed

Fixes issue with preversion script exposing the new updated package information instead of the currently existing one#51
luislobo wants to merge 2 commits into
npm:latestfrom
luislobo:fix-preversion-package-json

Conversation

@luislobo

Copy link
Copy Markdown
Contributor

Fixes issue with preversion script exposing the new updated package information instead of the currently existing one

Addresses issue described in https://npm.community/t/npm-version-preversion-npm-package-version/1406

…nformation instead of the currently existing one
@luislobo luislobo requested a review from a team as a code owner August 15, 2018 16:49
@zkat zkat added the semver:major backwards-incompatible breaking changes label Aug 15, 2018

@zkat zkat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you!

I believe this will be a semver-major change, so I'm gonna keep this PR open until npm@7 is ready to go out, and it should go in with that. Cheers!

@luislobo

Copy link
Copy Markdown
Contributor Author

@zkat Cool, thanks! In the meantime, I'm adding manual support in our preversion scripts, reading the package.json file, as the file do have the current version.

@luislobo

Copy link
Copy Markdown
Contributor Author

@zkat Don't forget about this one ;)

@luislobo

luislobo commented Mar 6, 2019

Copy link
Copy Markdown
Contributor Author

@zkat Friendly reminder about this PR

@chee

chee commented Mar 6, 2019

Copy link
Copy Markdown

@luislobo it's labeled as semver:major so they probably won't be looking at it until the next major version of npm is ready to go out, but they'll see it then! 😊

@luislobo

luislobo commented Sep 4, 2019

Copy link
Copy Markdown
Contributor Author

@isaacs Any news on getting this merged? We have had to workaround this issue reading the file ourselves to get the real information

@darcyclarke darcyclarke added the Release 7.x work is associated with a specific npm 7 release label Nov 19, 2019
@JanithaR

Copy link
Copy Markdown

It's 2020 March already. Any particular reason why this isn't already merged?

@ljharb

ljharb commented Mar 16, 2020

Copy link
Copy Markdown
Contributor

Because it's a semver-major change, and npm 7 hasn't gone out yet?

@JanithaR

Copy link
Copy Markdown

Because it's a semver-major change, and npm 7 hasn't gone out yet?

I ask stupid questions. :) But man this should've been a patch.

@luislobo

luislobo commented May 8, 2020

Copy link
Copy Markdown
Contributor Author

@isaacs is this going to be included in npm 7?

@isaacs

isaacs commented May 15, 2020

Copy link
Copy Markdown
Contributor

So, this patch won't be in v7, because that section of code has been rewritten, and npm-lifecycle is being put to bed for the long sleep of deprecated modules.

But here's what the preversion environment looks like in v7, which I think satisfies the need that this is addressing:

$ cat package.json
{
  "name": "name",
  "version": "1.2.4",
  "scripts": {
    "preversion": "env | grep npm_"
  }
}

$ node ../cli version patch
> name@1.2.4 preversion
> env | grep npm_
npm_config_metrics_registry=https://registry.npmjs.org/
npm_new_version=1.2.5
npm_old_version=1.2.4
npm_execpath=/Users/isaacs/dev/npm/cli/lib/npm.js
npm_config_access=public
npm_package_json=/Users/isaacs/dev/npm/foo/package.json
npm_command=version
npm_lifecycle_event=preversion
npm_config_node_gyp=/Users/isaacs/dev/npm/cli/node_modules/@npmcli/run-script/node_modules/node-gyp/bin/node-gyp.js
npm_lifecycle_script=env | grep npm_
npm_config_user_agent=npm/7.0.0-beta node/14.2.0 darwin x64
npm_node_execpath=/usr/local/bin/node
1.2.5

Let me know if there's more to do here, or if this meets your need. Thanks!

@luislobo

Copy link
Copy Markdown
Contributor Author

Looks good to me!

@luislobo luislobo closed this May 16, 2020
@luislobo luislobo deleted the fix-preversion-package-json branch May 16, 2020 02:03
antongolub pushed a commit to antongolub-forks/npm-cli that referenced this pull request May 18, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Jah-yee pushed a commit to Jah-yee/cli that referenced this pull request Apr 16, 2026
…unicode

fix(table): flatten nested objects to dot-notation, safe multi-byte truncation (fixes npm#40 npm#43)
github-actions Bot added a commit to Kevinlee7250/cli that referenced this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release 7.x work is associated with a specific npm 7 release semver:major backwards-incompatible breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants