Content-Length: 293403 | pFad | http://github.com/npm/cli/commit/38ca6d6a1d5715e60af32836e2191ed1215cae15

0A fix(publish): disregard deprecated versions when calculating highest … · npm/cli@38ca6d6 · GitHub
Skip to content

Commit 38ca6d6

Browse files
committed
fix(publish): disregard deprecated versions when calculating highest version
1 parent 695471f commit 38ca6d6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/commands/publish.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ class Publish extends BaseCommand {
217217
const ordered = Object.keys(packument?.versions)
218218
.flatMap(v => {
219219
const s = new semver.SemVer(v)
220-
return s.prerelease.length > 0 ? [] : s
220+
if ((s.prerelease.length > 0) || packument.versions[v].deprecated) {
221+
return []
222+
}
223+
return s
221224
})
222225
.sort((a, b) => b.compare(a))
223226
return ordered.length >= 1 ? ordered[0].version : null

test/lib/commands/publish.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ t.test('semver highest dist tag', async t => {
876876
// this needs more than one item in it to cover the sort logic
877877
{ version: '50.0.0' },
878878
{ version: '100.0.0' },
879+
{ version: '101.0.0', deprecated: 'oops' },
879880
{ version: '105.0.0-pre' },
880881
]
881882

0 commit comments

Comments
 (0)








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/commit/38ca6d6a1d5715e60af32836e2191ed1215cae15

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy