mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-06-08 13:11:11 +00:00
resolve comments
This commit is contained in:
parent
f12d842f13
commit
7f2fa59092
6 changed files with 153 additions and 384 deletions
|
@ -12,31 +12,20 @@ enum Distributions {
|
|||
RC = 'rc'
|
||||
}
|
||||
|
||||
function identifyDistribution(versionSpec: string) {
|
||||
let distribution = Distributions.DEFAULT;
|
||||
export function getNodejsDistribution(
|
||||
installerOptions: INodejs
|
||||
): BaseDistribution {
|
||||
const versionSpec = installerOptions.versionSpec;
|
||||
let distribution: BaseDistribution;
|
||||
if (versionSpec.includes(Distributions.NIGHTLY)) {
|
||||
distribution = Distributions.NIGHTLY;
|
||||
distribution = new NightlyNodejs(installerOptions);
|
||||
} else if (versionSpec.includes(Distributions.CANARY)) {
|
||||
distribution = Distributions.CANARY;
|
||||
distribution = new CanaryBuild(installerOptions);
|
||||
} else if (versionSpec.includes(Distributions.RC)) {
|
||||
distribution = Distributions.RC;
|
||||
distribution = new RcBuild(installerOptions);
|
||||
} else {
|
||||
distribution = new OfficialBuilds(installerOptions);
|
||||
}
|
||||
|
||||
return distribution;
|
||||
}
|
||||
|
||||
export function getNodejsDistribution(
|
||||
installerOptions: INodejs
|
||||
): BaseDistribution {
|
||||
const distributionName = identifyDistribution(installerOptions.versionSpec);
|
||||
switch (distributionName) {
|
||||
case Distributions.NIGHTLY:
|
||||
return new NightlyNodejs(installerOptions);
|
||||
case Distributions.CANARY:
|
||||
return new CanaryBuild(installerOptions);
|
||||
case Distributions.RC:
|
||||
return new RcBuild(installerOptions);
|
||||
default:
|
||||
return new OfficialBuilds(installerOptions);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue