mirror of
https://github.com/actions/setup-node.git
synced 2025-04-24 04:20:49 +00:00
minor changes
This commit is contained in:
parent
166e53bba8
commit
eec2a7e0d8
9 changed files with 184 additions and 148 deletions
166
dist/setup/index.js
vendored
166
dist/setup/index.js
vendored
|
@ -73220,6 +73220,81 @@ var Outputs;
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 957:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const tc = __importStar(__nccwpck_require__(7784));
|
||||||
|
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
||||||
|
const base_distribution_1 = __importDefault(__nccwpck_require__(7));
|
||||||
|
class BasePrereleaseNodejs extends base_distribution_1.default {
|
||||||
|
constructor(nodeInfo) {
|
||||||
|
super(nodeInfo);
|
||||||
|
}
|
||||||
|
findVersionInHostedToolCacheDirectory() {
|
||||||
|
let toolPath = '';
|
||||||
|
const localVersionPaths = tc
|
||||||
|
.findAllVersions('node', this.nodeInfo.arch)
|
||||||
|
.filter(i => {
|
||||||
|
const prerelease = semver_1.default.prerelease(i);
|
||||||
|
if (!prerelease) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return prerelease[0].includes(this.distribution);
|
||||||
|
});
|
||||||
|
localVersionPaths.sort(semver_1.default.rcompare);
|
||||||
|
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||||
|
if (localVersion) {
|
||||||
|
toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
|
||||||
|
}
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
validRange(versionSpec) {
|
||||||
|
let range;
|
||||||
|
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||||
|
const isValidVersion = semver_1.default.valid(raw);
|
||||||
|
const rawVersion = (isValidVersion ? raw : semver_1.default.coerce(raw));
|
||||||
|
if (prerelease !== this.distribution) {
|
||||||
|
range = versionSpec;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
range = `${semver_1.default.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||||
|
}
|
||||||
|
return { range, options: { includePrerelease: !isValidVersion } };
|
||||||
|
}
|
||||||
|
splitVersionSpec(versionSpec) {
|
||||||
|
return versionSpec.split(/-(.*)/s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports["default"] = BasePrereleaseNodejs;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 7:
|
/***/ 7:
|
||||||
|
@ -73281,24 +73356,15 @@ class BaseDistribution {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let nodeJsVersions;
|
let nodeJsVersions;
|
||||||
if (this.nodeInfo.checkLatest) {
|
if (this.nodeInfo.checkLatest) {
|
||||||
nodeJsVersions = yield this.getNodeJsVersions();
|
const evaluatedVersion = yield this.findVersionInDist(nodeJsVersions);
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
this.nodeInfo.versionSpec = evaluatedVersion;
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
if (evaluatedVersion) {
|
|
||||||
this.nodeInfo.versionSpec = evaluatedVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nodeJsVersions = nodeJsVersions !== null && nodeJsVersions !== void 0 ? nodeJsVersions : (yield this.getNodeJsVersions());
|
const evaluatedVersion = yield this.findVersionInDist(nodeJsVersions);
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
if (!evaluatedVersion) {
|
|
||||||
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
|
||||||
}
|
|
||||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
||||||
toolPath = yield this.downloadNodejs(toolName);
|
toolPath = yield this.downloadNodejs(toolName);
|
||||||
}
|
}
|
||||||
|
@ -73308,6 +73374,19 @@ class BaseDistribution {
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
findVersionInDist(nodeJsVersions) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!nodeJsVersions) {
|
||||||
|
nodeJsVersions = yield this.getNodeJsVersions();
|
||||||
|
}
|
||||||
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
|
if (!evaluatedVersion) {
|
||||||
|
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
||||||
|
}
|
||||||
|
return evaluatedVersion;
|
||||||
|
});
|
||||||
|
}
|
||||||
evaluateVersions(versions) {
|
evaluateVersions(versions) {
|
||||||
let version = '';
|
let version = '';
|
||||||
const { range, options } = this.validRange(this.nodeInfo.versionSpec);
|
const { range, options } = this.validRange(this.nodeInfo.versionSpec);
|
||||||
|
@ -73541,74 +73620,19 @@ exports.getNodejsDistribution = getNodejsDistribution;
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const tc = __importStar(__nccwpck_require__(7784));
|
const base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
||||||
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
class NightlyNodejs extends base_distribution_prerelease_1.default {
|
||||||
const base_distribution_1 = __importDefault(__nccwpck_require__(7));
|
|
||||||
class NightlyNodejs extends base_distribution_1.default {
|
|
||||||
constructor(nodeInfo) {
|
constructor(nodeInfo) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
this.distribution = 'nightly';
|
this.distribution = 'nightly';
|
||||||
}
|
}
|
||||||
findVersionInHostedToolCacheDirectory() {
|
|
||||||
let toolPath = '';
|
|
||||||
const localVersionPaths = tc
|
|
||||||
.findAllVersions('node', this.nodeInfo.arch)
|
|
||||||
.filter(i => {
|
|
||||||
const prerelease = semver_1.default.prerelease(i);
|
|
||||||
if (!prerelease) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return prerelease[0].includes(this.distribution);
|
|
||||||
});
|
|
||||||
localVersionPaths.sort(semver_1.default.rcompare);
|
|
||||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
|
||||||
if (localVersion) {
|
|
||||||
toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
|
|
||||||
}
|
|
||||||
return toolPath;
|
|
||||||
}
|
|
||||||
getDistributionUrl() {
|
getDistributionUrl() {
|
||||||
return 'https://nodejs.org/download/nightly';
|
return 'https://nodejs.org/download/nightly';
|
||||||
}
|
}
|
||||||
validRange(versionSpec) {
|
|
||||||
let range;
|
|
||||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
|
||||||
const isValidVersion = semver_1.default.valid(raw);
|
|
||||||
const rawVersion = (isValidVersion ? raw : semver_1.default.coerce(raw));
|
|
||||||
if (prerelease !== this.distribution) {
|
|
||||||
range = versionSpec;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
range = `${semver_1.default.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
|
||||||
}
|
|
||||||
return { range, options: { includePrerelease: !isValidVersion } };
|
|
||||||
}
|
|
||||||
splitVersionSpec(versionSpec) {
|
|
||||||
return versionSpec.split(/-(.*)/s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
exports["default"] = NightlyNodejs;
|
exports["default"] = NightlyNodejs;
|
||||||
|
|
||||||
|
@ -73853,8 +73877,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const nightly_builds_1 = __importDefault(__nccwpck_require__(7127));
|
const base_distribution_prerelease_1 = __importDefault(__nccwpck_require__(957));
|
||||||
class CanaryBuild extends nightly_builds_1.default {
|
class CanaryBuild extends base_distribution_prerelease_1.default {
|
||||||
constructor(nodeInfo) {
|
constructor(nodeInfo) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
this.distribution = 'v8-canary';
|
this.distribution = 'v8-canary';
|
||||||
|
|
53
src/distributions/base-distribution-prerelease.ts
Normal file
53
src/distributions/base-distribution-prerelease.ts
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
|
import semver from 'semver';
|
||||||
|
|
||||||
|
import BaseDistribution from './base-distribution';
|
||||||
|
import {NodeInputs} from './base-models';
|
||||||
|
|
||||||
|
export default abstract class BasePrereleaseNodejs extends BaseDistribution {
|
||||||
|
protected abstract distribution: string;
|
||||||
|
constructor(nodeInfo: NodeInputs) {
|
||||||
|
super(nodeInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected findVersionInHostedToolCacheDirectory(): string {
|
||||||
|
let toolPath = '';
|
||||||
|
const localVersionPaths = tc
|
||||||
|
.findAllVersions('node', this.nodeInfo.arch)
|
||||||
|
.filter(i => {
|
||||||
|
const prerelease = semver.prerelease(i);
|
||||||
|
if (!prerelease) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prerelease[0].includes(this.distribution);
|
||||||
|
});
|
||||||
|
localVersionPaths.sort(semver.rcompare);
|
||||||
|
const localVersion = this.evaluateVersions(localVersionPaths);
|
||||||
|
if (localVersion) {
|
||||||
|
toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected validRange(versionSpec: string) {
|
||||||
|
let range: string;
|
||||||
|
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
||||||
|
const isValidVersion = semver.valid(raw);
|
||||||
|
const rawVersion = (isValidVersion ? raw : semver.coerce(raw))!;
|
||||||
|
|
||||||
|
if (prerelease !== this.distribution) {
|
||||||
|
range = versionSpec;
|
||||||
|
} else {
|
||||||
|
range = `${semver.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {range, options: {includePrerelease: !isValidVersion}};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected splitVersionSpec(versionSpec: string) {
|
||||||
|
return versionSpec.split(/-(.*)/s);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,13 +10,13 @@ import * as path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import {INodejs, INodeVersion, INodeVersionInfo} from './base-models';
|
import {NodeInputs, INodeVersion, INodeVersionInfo} from './base-models';
|
||||||
|
|
||||||
export default abstract class BaseDistribution {
|
export default abstract class BaseDistribution {
|
||||||
protected httpClient: hc.HttpClient;
|
protected httpClient: hc.HttpClient;
|
||||||
protected osPlat = os.platform();
|
protected osPlat = os.platform();
|
||||||
|
|
||||||
constructor(protected nodeInfo: INodejs) {
|
constructor(protected nodeInfo: NodeInputs) {
|
||||||
this.httpClient = new hc.HttpClient('setup-node', [], {
|
this.httpClient = new hc.HttpClient('setup-node', [], {
|
||||||
allowRetries: true,
|
allowRetries: true,
|
||||||
maxRetries: 3
|
maxRetries: 3
|
||||||
|
@ -28,27 +28,15 @@ export default abstract class BaseDistribution {
|
||||||
public async setupNodeJs() {
|
public async setupNodeJs() {
|
||||||
let nodeJsVersions: INodeVersion[] | undefined;
|
let nodeJsVersions: INodeVersion[] | undefined;
|
||||||
if (this.nodeInfo.checkLatest) {
|
if (this.nodeInfo.checkLatest) {
|
||||||
nodeJsVersions = await this.getNodeJsVersions();
|
const evaluatedVersion = await this.findVersionInDist(nodeJsVersions);
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
this.nodeInfo.versionSpec = evaluatedVersion;
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
|
|
||||||
if (evaluatedVersion) {
|
|
||||||
this.nodeInfo.versionSpec = evaluatedVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
} else {
|
} else {
|
||||||
nodeJsVersions = nodeJsVersions ?? (await this.getNodeJsVersions());
|
const evaluatedVersion = await this.findVersionInDist(nodeJsVersions);
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
if (!evaluatedVersion) {
|
|
||||||
throw new Error(
|
|
||||||
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
||||||
toolPath = await this.downloadNodejs(toolName);
|
toolPath = await this.downloadNodejs(toolName);
|
||||||
}
|
}
|
||||||
|
@ -60,6 +48,21 @@ export default abstract class BaseDistribution {
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async findVersionInDist(nodeJsVersions?: INodeVersion[]) {
|
||||||
|
if (!nodeJsVersions) {
|
||||||
|
nodeJsVersions = await this.getNodeJsVersions();
|
||||||
|
}
|
||||||
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
|
if (!evaluatedVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return evaluatedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
protected evaluateVersions(versions: string[]): string {
|
protected evaluateVersions(versions: string[]): string {
|
||||||
let version = '';
|
let version = '';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export interface INodejs {
|
export interface NodeInputs {
|
||||||
versionSpec: string;
|
versionSpec: string;
|
||||||
arch: string;
|
arch: string;
|
||||||
auth?: string;
|
auth?: string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import BaseDistribution from './base-distribution';
|
import BaseDistribution from './base-distribution';
|
||||||
import {INodejs} from './base-models';
|
import {NodeInputs} from './base-models';
|
||||||
import NightlyNodejs from './nightly/nightly_builds';
|
import NightlyNodejs from './nightly/nightly_builds';
|
||||||
import OfficialBuilds from './official_builds/official_builds';
|
import OfficialBuilds from './official_builds/official_builds';
|
||||||
import RcBuild from './rc/rc_builds';
|
import RcBuild from './rc/rc_builds';
|
||||||
|
@ -13,7 +13,7 @@ enum Distributions {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNodejsDistribution(
|
export function getNodejsDistribution(
|
||||||
installerOptions: INodejs
|
installerOptions: NodeInputs
|
||||||
): BaseDistribution {
|
): BaseDistribution {
|
||||||
const versionSpec = installerOptions.versionSpec;
|
const versionSpec = installerOptions.versionSpec;
|
||||||
let distribution: BaseDistribution;
|
let distribution: BaseDistribution;
|
||||||
|
|
|
@ -1,57 +1,13 @@
|
||||||
import * as tc from '@actions/tool-cache';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
||||||
|
import {NodeInputs} from '../base-models';
|
||||||
|
|
||||||
import semver from 'semver';
|
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
||||||
|
|
||||||
import BaseDistribution from '../base-distribution';
|
|
||||||
import {INodejs} from '../base-models';
|
|
||||||
|
|
||||||
export default class NightlyNodejs extends BaseDistribution {
|
|
||||||
protected distribution = 'nightly';
|
protected distribution = 'nightly';
|
||||||
constructor(nodeInfo: INodejs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected findVersionInHostedToolCacheDirectory(): string {
|
|
||||||
let toolPath = '';
|
|
||||||
const localVersionPaths = tc
|
|
||||||
.findAllVersions('node', this.nodeInfo.arch)
|
|
||||||
.filter(i => {
|
|
||||||
const prerelease = semver.prerelease(i);
|
|
||||||
if (!prerelease) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return prerelease[0].includes(this.distribution);
|
|
||||||
});
|
|
||||||
localVersionPaths.sort(semver.rcompare);
|
|
||||||
const localVersion = this.evaluateVersions(localVersionPaths);
|
|
||||||
if (localVersion) {
|
|
||||||
toolPath = tc.find('node', localVersion, this.nodeInfo.arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
return toolPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
return 'https://nodejs.org/download/nightly';
|
return 'https://nodejs.org/download/nightly';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected validRange(versionSpec: string) {
|
|
||||||
let range: string;
|
|
||||||
const [raw, prerelease] = this.splitVersionSpec(versionSpec);
|
|
||||||
const isValidVersion = semver.valid(raw);
|
|
||||||
const rawVersion = (isValidVersion ? raw : semver.coerce(raw))!;
|
|
||||||
|
|
||||||
if (prerelease !== this.distribution) {
|
|
||||||
range = versionSpec;
|
|
||||||
} else {
|
|
||||||
range = `${semver.validRange(`^${rawVersion}-${this.distribution}`)}-0`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {range, options: {includePrerelease: !isValidVersion}};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected splitVersionSpec(versionSpec: string) {
|
|
||||||
return versionSpec.split(/-(.*)/s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@ import * as tc from '@actions/tool-cache';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import BaseDistribution from '../base-distribution';
|
import BaseDistribution from '../base-distribution';
|
||||||
import {INodejs, INodeVersion, INodeVersionInfo} from '../base-models';
|
import {NodeInputs, INodeVersion, INodeVersionInfo} from '../base-models';
|
||||||
|
|
||||||
interface INodeRelease extends tc.IToolRelease {
|
interface INodeRelease extends tc.IToolRelease {
|
||||||
lts?: string;
|
lts?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class OfficialBuilds extends BaseDistribution {
|
export default class OfficialBuilds extends BaseDistribution {
|
||||||
constructor(nodeInfo: INodejs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import BaseDistribution from '../base-distribution';
|
import BaseDistribution from '../base-distribution';
|
||||||
import {INodejs} from '../base-models';
|
import {NodeInputs} from '../base-models';
|
||||||
|
|
||||||
export default class RcBuild extends BaseDistribution {
|
export default class RcBuild extends BaseDistribution {
|
||||||
constructor(nodeInfo: INodejs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import {INodejs} from '../base-models';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
||||||
import NightlyNodejs from '../nightly/nightly_builds';
|
import {NodeInputs} from '../base-models';
|
||||||
|
|
||||||
export default class CanaryBuild extends NightlyNodejs {
|
export default class CanaryBuild extends BasePrereleaseNodejs {
|
||||||
constructor(nodeInfo: INodejs) {
|
protected distribution = 'v8-canary';
|
||||||
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
this.distribution = 'v8-canary';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
|
|
Loading…
Add table
Reference in a new issue