mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 03:28:42 +00:00
remove if
This commit is contained in:
parent
b372056939
commit
b717bf1b71
2 changed files with 22 additions and 32 deletions
22
dist/setup/index.js
vendored
22
dist/setup/index.js
vendored
|
@ -73245,18 +73245,16 @@ exports.nightlyV8MatcherFactory = (version, distribution) => {
|
|||
return matcher;
|
||||
};
|
||||
exports.splitVersionSpec = (versionSpec) => versionSpec.split(/-(.*)/s);
|
||||
const createRangePreRelease = (versionSpec, preRelease = '') => {
|
||||
const createRangePreRelease = (versionSpec, distribution = '') => {
|
||||
let range;
|
||||
const [raw, prerelease] = exports.splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver.valid(raw);
|
||||
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
||||
if (rawVersion) {
|
||||
if (`-${prerelease}` !== preRelease) {
|
||||
range = `${rawVersion}${`-${prerelease}`.replace(preRelease, `${preRelease}.`)}`;
|
||||
}
|
||||
else {
|
||||
range = `${semver.validRange(`^${rawVersion}${preRelease}`)}-0`;
|
||||
}
|
||||
const rawVersion = (isValidVersion ? raw : semver.coerce(raw));
|
||||
if (`-${prerelease}` !== distribution) {
|
||||
range = `${rawVersion}${`-${prerelease}`.replace(distribution, `${distribution}.`)}`;
|
||||
}
|
||||
else {
|
||||
range = `${semver.validRange(`^${rawVersion}${distribution}`)}-0`;
|
||||
}
|
||||
return { range, includePrerelease: !isValidVersion };
|
||||
};
|
||||
|
@ -73264,12 +73262,12 @@ function versionMatcherFactory(versionSpec) {
|
|||
var _a;
|
||||
const raw = exports.splitVersionSpec(versionSpec)[0];
|
||||
const validVersion = semver.valid(raw) ? raw : (_a = semver.coerce(raw)) === null || _a === void 0 ? void 0 : _a.version;
|
||||
const distribution = exports.distributionOf(versionSpec);
|
||||
if (validVersion) {
|
||||
switch (exports.distributionOf(versionSpec)) {
|
||||
switch (distribution) {
|
||||
case Distributions.CANARY:
|
||||
return exports.nightlyV8MatcherFactory(versionSpec, Distributions.CANARY);
|
||||
case Distributions.NIGHTLY:
|
||||
return exports.nightlyV8MatcherFactory(versionSpec, Distributions.NIGHTLY);
|
||||
return exports.nightlyV8MatcherFactory(versionSpec, distribution);
|
||||
case Distributions.RC:
|
||||
case Distributions.DEFAULT:
|
||||
return exports.semverVersionMatcherFactory(versionSpec);
|
||||
|
|
|
@ -87,22 +87,20 @@ export const splitVersionSpec = (versionSpec: string): string[] =>
|
|||
|
||||
const createRangePreRelease = (
|
||||
versionSpec: string,
|
||||
preRelease: string = ''
|
||||
distribution: string = ''
|
||||
) => {
|
||||
let range: string | undefined;
|
||||
const [raw, prerelease] = splitVersionSpec(versionSpec);
|
||||
const isValidVersion = semver.valid(raw);
|
||||
const rawVersion = isValidVersion ? raw : semver.coerce(raw);
|
||||
const rawVersion = (isValidVersion ? raw : semver.coerce(raw))!;
|
||||
|
||||
if (rawVersion) {
|
||||
if (`-${prerelease}` !== preRelease) {
|
||||
range = `${rawVersion}${`-${prerelease}`.replace(
|
||||
preRelease,
|
||||
`${preRelease}.`
|
||||
)}`;
|
||||
} else {
|
||||
range = `${semver.validRange(`^${rawVersion}${preRelease}`)}-0`;
|
||||
}
|
||||
if (`-${prerelease}` !== distribution) {
|
||||
range = `${rawVersion}${`-${prerelease}`.replace(
|
||||
distribution,
|
||||
`${distribution}.`
|
||||
)}`;
|
||||
} else {
|
||||
range = `${semver.validRange(`^${rawVersion}${distribution}`)}-0`;
|
||||
}
|
||||
|
||||
return {range, includePrerelease: !isValidVersion};
|
||||
|
@ -111,19 +109,13 @@ const createRangePreRelease = (
|
|||
export function versionMatcherFactory(versionSpec: string): VersionMatcher {
|
||||
const raw = splitVersionSpec(versionSpec)[0];
|
||||
const validVersion = semver.valid(raw) ? raw : semver.coerce(raw)?.version;
|
||||
const distribution = distributionOf(versionSpec);
|
||||
|
||||
if (validVersion) {
|
||||
switch (distributionOf(versionSpec)) {
|
||||
switch (distribution) {
|
||||
case Distributions.CANARY:
|
||||
return nightlyV8MatcherFactory(
|
||||
versionSpec,
|
||||
Distributions.CANARY
|
||||
);
|
||||
case Distributions.NIGHTLY:
|
||||
return nightlyV8MatcherFactory(
|
||||
versionSpec,
|
||||
Distributions.NIGHTLY
|
||||
);
|
||||
return nightlyV8MatcherFactory(versionSpec, distribution);
|
||||
case Distributions.RC:
|
||||
case Distributions.DEFAULT:
|
||||
return semverVersionMatcherFactory(versionSpec);
|
||||
|
|
Loading…
Add table
Reference in a new issue