gitea push
This commit is contained in:
+19
-4
@@ -56,6 +56,7 @@ const semverCompareLoose = require('semver/functions/compare-loose')
|
||||
const semverCompareBuild = require('semver/functions/compare-build')
|
||||
const semverSort = require('semver/functions/sort')
|
||||
const semverRsort = require('semver/functions/rsort')
|
||||
const semverTruncate = require('semver/functions/truncate')
|
||||
|
||||
// low-level comparators between versions
|
||||
const semverGt = require('semver/functions/gt')
|
||||
@@ -399,12 +400,19 @@ nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
pre ::= prepart ( '.' prepart ) *
|
||||
prepart ::= nr | alphanumid
|
||||
build ::= buildid ( '.' buildid ) *
|
||||
alphanumid ::= ( ['0'-'9'] ) * [-A-Za-z] [-0-9A-Za-z] *
|
||||
buildid ::= [-0-9A-Za-z]+
|
||||
```
|
||||
|
||||
Note: Prerelease identifiers (`pre`) use `nr` for numeric parts, which
|
||||
disallows leading zeros (e.g., `1.2.3-00` is invalid). Build metadata
|
||||
identifiers (`build`) allow any alphanumeric string including leading
|
||||
zeros (e.g., `1.2.3+00` is valid). This matches the
|
||||
[SemVer 2.0.0 specification](https://semver.org/#spec-item-9).
|
||||
|
||||
## Functions
|
||||
|
||||
All methods and classes take a final `options` object argument. All
|
||||
@@ -449,6 +457,12 @@ strings that they parse.
|
||||
or comparators intersect.
|
||||
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
|
||||
a `SemVer` object or `null`.
|
||||
* `truncate(v, releaseType)`: Return the version with components _lower_
|
||||
than `releaseType` dropped off, e.g.:
|
||||
* `major` removes build & prerelease info and sets minor & patch to 0.
|
||||
* `minor` removes build & prerelease info, and sets patch to 0
|
||||
* `patch` removes build & prerelease info
|
||||
* All prerelease types remove build info only
|
||||
|
||||
### Comparison
|
||||
|
||||
@@ -650,6 +664,7 @@ The following modules are available:
|
||||
* `require('semver/functions/rsort')`
|
||||
* `require('semver/functions/satisfies')`
|
||||
* `require('semver/functions/sort')`
|
||||
* `require('semver/functions/truncate')`
|
||||
* `require('semver/functions/valid')`
|
||||
* `require('semver/ranges/gtr')`
|
||||
* `require('semver/ranges/intersects')`
|
||||
|
||||
+14
-10
@@ -46,6 +46,7 @@ const main = () => {
|
||||
a = a.slice(0, indexOfEqualSign)
|
||||
argv.unshift(value)
|
||||
}
|
||||
|
||||
switch (a) {
|
||||
case '-rv': case '-rev': case '--rev': case '--reverse':
|
||||
reverse = true
|
||||
@@ -60,15 +61,10 @@ const main = () => {
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
case '-i': case '--inc': case '--increment':
|
||||
switch (argv[0]) {
|
||||
case 'major': case 'minor': case 'patch': case 'prerelease':
|
||||
case 'premajor': case 'preminor': case 'prepatch':
|
||||
case 'release':
|
||||
inc = argv.shift()
|
||||
break
|
||||
default:
|
||||
inc = 'patch'
|
||||
break
|
||||
if (semver.RELEASE_TYPES.includes(argv[0]) || (argv[0] === 'release')) {
|
||||
inc = { value: argv.shift(), maybeErrantValue: null, option: a }
|
||||
} else {
|
||||
inc = { value: 'patch', maybeErrantValue: argv[0], option: a }
|
||||
}
|
||||
break
|
||||
case '--preid':
|
||||
@@ -102,6 +98,14 @@ const main = () => {
|
||||
|
||||
options = parseOptions({ loose, includePrerelease, rtl })
|
||||
|
||||
if (
|
||||
inc &&
|
||||
versions.includes(inc.maybeErrantValue) &&
|
||||
!semver.valid(inc.maybeErrantValue, options)
|
||||
) {
|
||||
console.warn(`Invalid value for ${inc.option}; defaulting to 'patch'. This may become a failure in future major versions.`)
|
||||
}
|
||||
|
||||
versions = versions.map((v) => {
|
||||
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
|
||||
}).filter((v) => {
|
||||
@@ -125,7 +129,7 @@ const main = () => {
|
||||
versions
|
||||
.sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
|
||||
.map(v => semver.clean(v, options))
|
||||
.map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v)
|
||||
.map(v => inc ? semver.inc(v, inc.value, options, identifier, identifierBase) : v)
|
||||
.forEach(v => console.log(v))
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -28,6 +28,7 @@ const gte = require('./functions/gte')
|
||||
const lte = require('./functions/lte')
|
||||
const cmp = require('./functions/cmp')
|
||||
const coerce = require('./functions/coerce')
|
||||
const truncate = require('./functions/truncate')
|
||||
const Comparator = require('./classes/comparator')
|
||||
const Range = require('./classes/range')
|
||||
const satisfies = require('./functions/satisfies')
|
||||
@@ -66,6 +67,7 @@ module.exports = {
|
||||
lte,
|
||||
cmp,
|
||||
coerce,
|
||||
truncate,
|
||||
Comparator,
|
||||
Range,
|
||||
satisfies,
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
|
||||
createToken('GTLT', '((?:<|>)?=?)')
|
||||
|
||||
// Something like "2.*" or "1.2.x".
|
||||
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
||||
// Note that "x.x" is a valid xRange identifier, meaning "any version"
|
||||
// Only the first item is strictly required.
|
||||
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
|
||||
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "semver",
|
||||
"version": "7.7.4",
|
||||
"version": "7.8.0",
|
||||
"description": "The semantic version parser used by npm.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -15,7 +15,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^6.0.0",
|
||||
"@npmcli/template-oss": "4.29.0",
|
||||
"@npmcli/template-oss": "5.0.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"tap": "^16.0.0"
|
||||
},
|
||||
@@ -52,7 +52,7 @@
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.29.0",
|
||||
"version": "5.0.0",
|
||||
"engines": ">=10",
|
||||
"distPaths": [
|
||||
"classes/",
|
||||
|
||||
+5
-4
@@ -10,7 +10,8 @@ nr ::= '0' | [1-9] ( [0-9] ) *
|
||||
tilde ::= '~' partial
|
||||
caret ::= '^' partial
|
||||
qualifier ::= ( '-' pre )? ( '+' build )?
|
||||
pre ::= parts
|
||||
build ::= parts
|
||||
parts ::= part ( '.' part ) *
|
||||
part ::= nr | [-0-9A-Za-z]+
|
||||
pre ::= prepart ( '.' prepart ) *
|
||||
prepart ::= nr | alphanumid
|
||||
build ::= buildid ( '.' buildid ) *
|
||||
alphanumid ::= ( [0-9] ) * [A-Za-z-] [-0-9A-Za-z] *
|
||||
buildid ::= [-0-9A-Za-z]+
|
||||
|
||||
Reference in New Issue
Block a user