Skip to content

Commit

Permalink
Add support for simple versions without "v" (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Feb 22, 2021
1 parent 57c4c3e commit 28f3e65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/version-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function isPre(version) {
}

/** Checks if a string is a simple version in the format "v1". */
const isSimpleVersion = s => /^[vV]\d+$/.test(s)
const isSimpleVersion = s => /^[vV]?\d+$/.test(s)

/**
* Returns 'v' if the string starts with a v, otherwise returns empty string.
Expand Down
1 change: 1 addition & 0 deletions test/versionmanager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ describe('versionmanager', () => {
describe('upgradeDependencies', () => {

it('upgrade simple, non-semver versions', () => {
vm.upgradeDependencies({ foo: '1' }, { foo: '2' }).should.eql({ foo: '2' })
vm.upgradeDependencies({ mongodb: '0.5' }, { mongodb: '1.4.30' }).should.eql({ mongodb: '1.4' })
vm.upgradeDependencies({ 'ncu-test-simple-tag': 'v1' }, { 'ncu-test-simple-tag': 'v3' }).should.eql({ 'ncu-test-simple-tag': 'v3' })
})
Expand Down

0 comments on commit 28f3e65

Please sign in to comment.