Content-Length: 309336 | pFad | http://github.com/npm/cli/pull/8038/commits/02512d1b7a4527d31bc8b7d7e18f6b5bc0670b72

2C publish semver checking bugfixes by wraithgar · Pull Request #8038 · npm/cli · GitHub
Skip to content

publish semver checking bugfixes #8038

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

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(publish): disregard deprecated versions when calculating highest …
…version
  • Loading branch information
wraithgar committed Jan 16, 2025
commit 02512d1b7a4527d31bc8b7d7e18f6b5bc0670b72
5 changes: 4 additions & 1 deletion lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ class Publish extends BaseCommand {
const ordered = Object.keys(packument?.versions)
.flatMap(v => {
const s = new semver.SemVer(v)
return s.prerelease.length > 0 ? [] : s
if ((s.prerelease.length > 0) || packument.versions[v].deprecated) {
return []
}
return s
})
.sort((a, b) => b.compare(a))
return ordered.length >= 1 ? ordered[0].version : null
Expand Down
1 change: 1 addition & 0 deletions test/lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ t.test('semver highest dist tag', async t => {
// this needs more than one item in it to cover the sort logic
{ version: '50.0.0' },
{ version: '100.0.0' },
{ version: '102.0.0', deprecated: 'oops' },
{ version: '105.0.0-pre' },
]

Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/npm/cli/pull/8038/commits/02512d1b7a4527d31bc8b7d7e18f6b5bc0670b72

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy