Skip to content

Commit 66c7ff1

Browse files
committed
deps: semver@7.8.0
1 parent 514c71b commit 66c7ff1

8 files changed

Lines changed: 78 additions & 23 deletions

File tree

node_modules/semver/bin/semver.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const main = () => {
4646
a = a.slice(0, indexOfEqualSign)
4747
argv.unshift(value)
4848
}
49+
4950
switch (a) {
5051
case '-rv': case '-rev': case '--rev': case '--reverse':
5152
reverse = true
@@ -60,15 +61,10 @@ const main = () => {
6061
versions.push(argv.shift())
6162
break
6263
case '-i': case '--inc': case '--increment':
63-
switch (argv[0]) {
64-
case 'major': case 'minor': case 'patch': case 'prerelease':
65-
case 'premajor': case 'preminor': case 'prepatch':
66-
case 'release':
67-
inc = argv.shift()
68-
break
69-
default:
70-
inc = 'patch'
71-
break
64+
if (semver.RELEASE_TYPES.includes(argv[0]) || (argv[0] === 'release')) {
65+
inc = { value: argv.shift(), maybeErrantValue: null, option: a }
66+
} else {
67+
inc = { value: 'patch', maybeErrantValue: argv[0], option: a }
7268
}
7369
break
7470
case '--preid':
@@ -102,6 +98,14 @@ const main = () => {
10298

10399
options = parseOptions({ loose, includePrerelease, rtl })
104100

101+
if (
102+
inc &&
103+
versions.includes(inc.maybeErrantValue) &&
104+
!semver.valid(inc.maybeErrantValue, options)
105+
) {
106+
console.warn(`Invalid value for ${inc.option}; defaulting to 'patch'. This may become a failure in future major versions.`)
107+
}
108+
105109
versions = versions.map((v) => {
106110
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
107111
}).filter((v) => {
@@ -125,7 +129,7 @@ const main = () => {
125129
versions
126130
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
127131
.map(v => semver.clean(v, options))
128-
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
132+
.map(v => inc ? semver.inc(v, inc.value, options, identifier, identifierBase) : v)
129133
.forEach(v => console.log(v))
130134
}
131135

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict'
2+
3+
const parse = require('./parse')
4+
const constants = require('../internal/constants')
5+
const SemVer = require('../classes/semver')
6+
7+
const truncate = (version, truncation, options) => {
8+
if (!constants.RELEASE_TYPES.includes(truncation)) {
9+
return null
10+
}
11+
12+
const clonedVersion = cloneInputVersion(version, options)
13+
return clonedVersion && doTruncation(clonedVersion, truncation)
14+
}
15+
16+
const cloneInputVersion = (version, options) => {
17+
const versionStringToParse = (
18+
version instanceof SemVer ? version.version : version
19+
)
20+
21+
return parse(versionStringToParse, options)
22+
}
23+
24+
const doTruncation = (version, truncation) => {
25+
if (isPrerelease(truncation)) {
26+
return version.version
27+
}
28+
29+
version.prerelease = []
30+
31+
switch (truncation) {
32+
case 'major':
33+
version.minor = 0
34+
version.patch = 0
35+
break
36+
case 'minor':
37+
version.patch = 0
38+
break
39+
}
40+
41+
return version.format()
42+
}
43+
44+
const isPrerelease = (type) => {
45+
return type.startsWith('pre')
46+
}
47+
48+
module.exports = truncate

node_modules/semver/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const gte = require('./functions/gte')
2828
const lte = require('./functions/lte')
2929
const cmp = require('./functions/cmp')
3030
const coerce = require('./functions/coerce')
31+
const truncate = require('./functions/truncate')
3132
const Comparator = require('./classes/comparator')
3233
const Range = require('./classes/range')
3334
const satisfies = require('./functions/satisfies')
@@ -66,6 +67,7 @@ module.exports = {
6667
lte,
6768
cmp,
6869
coerce,
70+
truncate,
6971
Comparator,
7072
Range,
7173
satisfies,

node_modules/semver/internal/re.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
136136
createToken('GTLT', '((?:<|>)?=?)')
137137

138138
// Something like "2.*" or "1.2.x".
139-
// Note that "x.x" is a valid xRange identifer, meaning "any version"
139+
// Note that "x.x" is a valid xRange identifier, meaning "any version"
140140
// Only the first item is strictly required.
141141
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
142142
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)

node_modules/semver/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "semver",
3-
"version": "7.7.4",
3+
"version": "7.8.0",
44
"description": "The semantic version parser used by npm.",
55
"main": "index.js",
66
"scripts": {
@@ -15,7 +15,7 @@
1515
},
1616
"devDependencies": {
1717
"@npmcli/eslint-config": "^6.0.0",
18-
"@npmcli/template-oss": "4.29.0",
18+
"@npmcli/template-oss": "5.0.0",
1919
"benchmark": "^2.1.4",
2020
"tap": "^16.0.0"
2121
},
@@ -52,7 +52,7 @@
5252
"author": "GitHub Inc.",
5353
"templateOSS": {
5454
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
55-
"version": "4.29.0",
55+
"version": "5.0.0",
5656
"engines": ">=10",
5757
"distPaths": [
5858
"classes/",

node_modules/semver/range.bnf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ nr ::= '0' | [1-9] ( [0-9] ) *
1010
tilde ::= '~' partial
1111
caret ::= '^' partial
1212
qualifier ::= ( '-' pre )? ( '+' build )?
13-
pre ::= parts
14-
build ::= parts
15-
parts ::= part ( '.' part ) *
16-
part ::= nr | [-0-9A-Za-z]+
13+
pre ::= prepart ( '.' prepart ) *
14+
prepart ::= nr | alphanumid
15+
build ::= buildid ( '.' buildid ) *
16+
alphanumid ::= ( [0-9] ) * [A-Za-z-] [-0-9A-Za-z] *
17+
buildid ::= [-0-9A-Za-z]+

package-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"proc-log": "^6.1.0",
139139
"qrcode-terminal": "^0.12.0",
140140
"read": "^5.0.1",
141-
"semver": "^7.7.4",
141+
"semver": "^7.8.0",
142142
"spdx-expression-parse": "^4.0.0",
143143
"ssri": "^13.0.1",
144144
"supports-color": "^10.2.2",
@@ -10609,9 +10609,9 @@
1060910609
}
1061010610
},
1061110611
"node_modules/semver": {
10612-
"version": "7.7.4",
10613-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
10614-
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
10612+
"version": "7.8.0",
10613+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz",
10614+
"integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==",
1061510615
"inBundle": true,
1061610616
"license": "ISC",
1061710617
"bin": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"proc-log": "^6.1.0",
103103
"qrcode-terminal": "^0.12.0",
104104
"read": "^5.0.1",
105-
"semver": "^7.7.4",
105+
"semver": "^7.8.0",
106106
"spdx-expression-parse": "^4.0.0",
107107
"ssri": "^13.0.1",
108108
"supports-color": "^10.2.2",

0 commit comments

Comments
 (0)