Skip to content

Commit

Permalink
Merge pull request #1343 from MeilCli/update/action
Browse files Browse the repository at this point in the history
update actions
  • Loading branch information
MeilCli authored Jan 29, 2025
2 parents 2f9663b + 96d159d commit 0351520
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13689,7 +13689,7 @@ class SemVer {

if (version instanceof SemVer) {
if (version.loose === !!options.loose &&
version.includePrerelease === !!options.includePrerelease) {
version.includePrerelease === !!options.includePrerelease) {
return version
} else {
version = version.version
Expand Down Expand Up @@ -13855,6 +13855,19 @@ class SemVer {
// preminor will bump the version up to the next minor release, and immediately
// down to pre-release. premajor and prepatch work the same way.
inc (release, identifier, identifierBase) {
if (release.startsWith('pre')) {
if (!identifier && identifierBase === false) {
throw new Error('invalid increment argument: identifier is empty')
}
// Avoid an invalid semver results
if (identifier) {
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
if (!match || match[1] !== identifier) {
throw new Error(`invalid identifier: ${identifier}`)
}
}
}

switch (release) {
case 'premajor':
this.prerelease.length = 0
Expand Down Expand Up @@ -13885,6 +13898,12 @@ class SemVer {
}
this.inc('pre', identifier, identifierBase)
break
case 'release':
if (this.prerelease.length === 0) {
throw new Error(`version ${this.raw} is not a prerelease`)
}
this.prerelease.length = 0
break

case 'major':
// If this is a pre-major version, bump up to the same major version.
Expand Down Expand Up @@ -13928,10 +13947,6 @@ class SemVer {
case 'pre': {
const base = Number(identifierBase) ? 1 : 0

if (!identifier && identifierBase === false) {
throw new Error('invalid increment argument: identifier is empty')
}

if (this.prerelease.length === 0) {
this.prerelease = [base]
} else {
Expand Down Expand Up @@ -14190,20 +14205,13 @@ const diff = (version1, version2) => {
return 'major'
}

// Otherwise it can be determined by checking the high version

if (highVersion.patch) {
// anything higher than a patch bump would result in the wrong version
// If the main part has no difference
if (lowVersion.compareMain(highVersion) === 0) {
if (lowVersion.minor && !lowVersion.patch) {
return 'minor'
}
return 'patch'
}

if (highVersion.minor) {
// anything higher than a minor bump would result in the wrong version
return 'minor'
}

// bumping major/minor/patch all have same result
return 'major'
}

// add the `pre` prefix if we are going to a prerelease version
Expand Down

0 comments on commit 0351520

Please sign in to comment.