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

fix(deps): npm-package-arg now normalize x, x@, x@* #400

Merged
merged 3 commits into from Oct 21, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Oct 21, 2022

Description

As per npm-package-arg (npa) new version 10.x PR which is a Breaking Change

Right now, name@ and name are parsed with {type:'tag', fetchSpec: 'latest'}, but name@* is parsed as {type: 'range'}. But since '' is a valid semver range, it should be parsed the same as *.

This also saves npm-package-arg from guessing the default tag, which currently poses some semantic hazards. npm (via npm-pick-manifest) will prefer its default tag if given a range that includes it. But name@latest should always and only resolve to that specific version in the dist-tags. So npm-pick-manifest and pacote have to detect this and do some extra work to figure out if latest was actually specified or just guessed as a default.

  1. npa('name@')
  2. npa('name')
  3. npa('name@*')

All 3 should parse the same, like (3) above. Effectively, a '' spec should be changed to '*' and interpreted accordingly..

The new npa v10 version now normalize all 3 above to the same result {type: 'range', fetchSpec: ''}

Motivation and Context

When providing "pkg-1": "*", it will no longer return fetchSpec: 'latest' with v10.x, instead it will now return an empty string as in fetchSpec: ''

How Has This Been Tested?

Types of changes

  • Chore (change that has absolutely no effect on users)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- npa will no longer return "latest" when passing `*` but instead it will return empty string "" as per their new v10 PR: npm/statusboard#460
@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Merging #400 (6954cef) into main (4eaea64) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #400   +/-   ##
=======================================
  Coverage   97.31%   97.31%           
=======================================
  Files         146      146           
  Lines        4335     4335           
  Branches     1004     1004           
=======================================
  Hits         4218     4218           
  Misses        117      117           
Impacted Files Coverage Δ
packages/core/src/package.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ghiscoding ghiscoding merged commit 41b6eaa into main Oct 21, 2022
@ghiscoding ghiscoding deleted the bugfix/npa-v10-changes branch October 21, 2022 05:40
@ghiscoding ghiscoding added the dependencies Pull requests that update a dependency file label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant