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
df00183c09
commit
e81c4f8a21
14 changed files with 78 additions and 78 deletions
|
@ -1,42 +0,0 @@
|
|||
import BaseDistribution from './base-distribution';
|
||||
import {INodejs} from './base-models';
|
||||
import NightlyNodejs from './nightly/nightly_builds';
|
||||
import OfficialBuilds from './official_builds/official_builds';
|
||||
import RcBuild from './official_builds/rc/rc_builds';
|
||||
import CanaryBuild from './v8-canary/canary_builds';
|
||||
|
||||
enum Distributions {
|
||||
DEFAULT = '',
|
||||
CANARY = 'v8-canary',
|
||||
NIGHTLY = 'nightly',
|
||||
RC = 'rc'
|
||||
}
|
||||
|
||||
function identifyDistribution(versionSpec: string) {
|
||||
let distribution = Distributions.DEFAULT;
|
||||
if (versionSpec.includes(Distributions.NIGHTLY)) {
|
||||
distribution = Distributions.NIGHTLY;
|
||||
} else if (versionSpec.includes(Distributions.CANARY)) {
|
||||
distribution = Distributions.CANARY;
|
||||
} else if (versionSpec.includes(Distributions.RC)) {
|
||||
distribution = Distributions.RC;
|
||||
}
|
||||
|
||||
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