mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	feat: add volta as node-version-file
This commit is contained in:
		
							
								
								
									
										376
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										376
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							@@ -59827,74 +59827,74 @@ exports.fromPromise = function (fn) {
 | 
				
			|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
					/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
					var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
				
			||||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
					    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
				
			||||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
					    return new (P || (P = Promise))(function (resolve, reject) {
 | 
				
			||||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
					        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
				
			||||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
					        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
				
			||||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
					        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
				
			||||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
					        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
					var __importStar = (this && this.__importStar) || function (mod) {
 | 
				
			||||||
    if (mod && mod.__esModule) return mod;
 | 
					    if (mod && mod.__esModule) return mod;
 | 
				
			||||||
    var result = {};
 | 
					    var result = {};
 | 
				
			||||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
					    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
				
			||||||
    result["default"] = mod;
 | 
					    result["default"] = mod;
 | 
				
			||||||
    return result;
 | 
					    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 core = __importStar(__nccwpck_require__(2186));
 | 
					const core = __importStar(__nccwpck_require__(2186));
 | 
				
			||||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
					const cache = __importStar(__nccwpck_require__(7799));
 | 
				
			||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
 | 
					const fs_1 = __importDefault(__nccwpck_require__(7147));
 | 
				
			||||||
const constants_1 = __nccwpck_require__(9042);
 | 
					const constants_1 = __nccwpck_require__(9042);
 | 
				
			||||||
const cache_utils_1 = __nccwpck_require__(1678);
 | 
					const cache_utils_1 = __nccwpck_require__(1678);
 | 
				
			||||||
// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
					// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
				
			||||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | 
					// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | 
				
			||||||
// throw an uncaught exception.  Instead of failing this action, just warn.
 | 
					// throw an uncaught exception.  Instead of failing this action, just warn.
 | 
				
			||||||
process.on('uncaughtException', e => {
 | 
					process.on('uncaughtException', e => {
 | 
				
			||||||
    const warningPrefix = '[warning]';
 | 
					    const warningPrefix = '[warning]';
 | 
				
			||||||
    core.info(`${warningPrefix}${e.message}`);
 | 
					    core.info(`${warningPrefix}${e.message}`);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
function run() {
 | 
					function run() {
 | 
				
			||||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
					    return __awaiter(this, void 0, void 0, function* () {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const cacheLock = core.getInput('cache');
 | 
					            const cacheLock = core.getInput('cache');
 | 
				
			||||||
            yield cachePackages(cacheLock);
 | 
					            yield cachePackages(cacheLock);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch (error) {
 | 
					        catch (error) {
 | 
				
			||||||
            core.setFailed(error.message);
 | 
					            core.setFailed(error.message);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.run = run;
 | 
					exports.run = run;
 | 
				
			||||||
const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					const cachePackages = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    const state = core.getState(constants_1.State.CacheMatchedKey);
 | 
					    const state = core.getState(constants_1.State.CacheMatchedKey);
 | 
				
			||||||
    const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
 | 
					    const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
 | 
				
			||||||
    const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
 | 
					    const packageManagerInfo = yield cache_utils_1.getPackageManagerInfo(packageManager);
 | 
				
			||||||
    if (!packageManagerInfo) {
 | 
					    if (!packageManagerInfo) {
 | 
				
			||||||
        core.debug(`Caching for '${packageManager}' is not supported`);
 | 
					        core.debug(`Caching for '${packageManager}' is not supported`);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
 | 
					    const cachePath = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo, packageManager);
 | 
				
			||||||
    if (!fs_1.default.existsSync(cachePath)) {
 | 
					    if (!fs_1.default.existsSync(cachePath)) {
 | 
				
			||||||
        throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
 | 
					        throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePath}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (primaryKey === state) {
 | 
					    if (primaryKey === state) {
 | 
				
			||||||
        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
					        core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const cacheId = yield cache.saveCache([cachePath], primaryKey);
 | 
					    const cacheId = yield cache.saveCache([cachePath], primaryKey);
 | 
				
			||||||
    if (cacheId == -1) {
 | 
					    if (cacheId == -1) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    core.info(`Cache saved with the key: ${primaryKey}`);
 | 
					    core.info(`Cache saved with the key: ${primaryKey}`);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
run();
 | 
					run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
@@ -59903,109 +59903,109 @@ run();
 | 
				
			|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
					/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
					var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
				
			||||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
					    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
				
			||||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
					    return new (P || (P = Promise))(function (resolve, reject) {
 | 
				
			||||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
					        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
				
			||||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
					        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
				
			||||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
					        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
				
			||||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
					        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
					var __importStar = (this && this.__importStar) || function (mod) {
 | 
				
			||||||
    if (mod && mod.__esModule) return mod;
 | 
					    if (mod && mod.__esModule) return mod;
 | 
				
			||||||
    var result = {};
 | 
					    var result = {};
 | 
				
			||||||
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
					    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
 | 
				
			||||||
    result["default"] = mod;
 | 
					    result["default"] = mod;
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
					Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
				
			||||||
const core = __importStar(__nccwpck_require__(2186));
 | 
					const core = __importStar(__nccwpck_require__(2186));
 | 
				
			||||||
const exec = __importStar(__nccwpck_require__(1514));
 | 
					const exec = __importStar(__nccwpck_require__(1514));
 | 
				
			||||||
const cache = __importStar(__nccwpck_require__(7799));
 | 
					const cache = __importStar(__nccwpck_require__(7799));
 | 
				
			||||||
exports.supportedPackageManagers = {
 | 
					exports.supportedPackageManagers = {
 | 
				
			||||||
    npm: {
 | 
					    npm: {
 | 
				
			||||||
        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
					        lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'npm config get cache'
 | 
					        getCacheFolderCommand: 'npm config get cache'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    pnpm: {
 | 
					    pnpm: {
 | 
				
			||||||
        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
					        lockFilePatterns: ['pnpm-lock.yaml'],
 | 
				
			||||||
        getCacheFolderCommand: 'pnpm store path'
 | 
					        getCacheFolderCommand: 'pnpm store path'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    yarn1: {
 | 
					    yarn1: {
 | 
				
			||||||
        lockFilePatterns: ['yarn.lock'],
 | 
					        lockFilePatterns: ['yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'yarn cache dir'
 | 
					        getCacheFolderCommand: 'yarn cache dir'
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    yarn2: {
 | 
					    yarn2: {
 | 
				
			||||||
        lockFilePatterns: ['yarn.lock'],
 | 
					        lockFilePatterns: ['yarn.lock'],
 | 
				
			||||||
        getCacheFolderCommand: 'yarn config get cacheFolder'
 | 
					        getCacheFolderCommand: 'yarn config get cacheFolder'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
 | 
					    let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
 | 
				
			||||||
    if (exitCode) {
 | 
					    if (exitCode) {
 | 
				
			||||||
        stderr = !stderr.trim()
 | 
					        stderr = !stderr.trim()
 | 
				
			||||||
            ? `The '${toolCommand}' command failed with exit code: ${exitCode}`
 | 
					            ? `The '${toolCommand}' command failed with exit code: ${exitCode}`
 | 
				
			||||||
            : stderr;
 | 
					            : stderr;
 | 
				
			||||||
        throw new Error(stderr);
 | 
					        throw new Error(stderr);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return stdout.trim();
 | 
					    return stdout.trim();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					const getPackageManagerVersion = (packageManager, command) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
					    const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`);
 | 
				
			||||||
    if (!stdOut) {
 | 
					    if (!stdOut) {
 | 
				
			||||||
        throw new Error(`Could not retrieve version of ${packageManager}`);
 | 
					        throw new Error(`Could not retrieve version of ${packageManager}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return stdOut;
 | 
					    return stdOut;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    if (packageManager === 'npm') {
 | 
					    if (packageManager === 'npm') {
 | 
				
			||||||
        return exports.supportedPackageManagers.npm;
 | 
					        return exports.supportedPackageManagers.npm;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (packageManager === 'pnpm') {
 | 
					    else if (packageManager === 'pnpm') {
 | 
				
			||||||
        return exports.supportedPackageManagers.pnpm;
 | 
					        return exports.supportedPackageManagers.pnpm;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else if (packageManager === 'yarn') {
 | 
					    else if (packageManager === 'yarn') {
 | 
				
			||||||
        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
					        const yarnVersion = yield getPackageManagerVersion('yarn', '--version');
 | 
				
			||||||
        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
					        core.debug(`Consumed yarn version is ${yarnVersion}`);
 | 
				
			||||||
        if (yarnVersion.startsWith('1.')) {
 | 
					        if (yarnVersion.startsWith('1.')) {
 | 
				
			||||||
            return exports.supportedPackageManagers.yarn1;
 | 
					            return exports.supportedPackageManagers.yarn1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            return exports.supportedPackageManagers.yarn2;
 | 
					            return exports.supportedPackageManagers.yarn2;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else {
 | 
					    else {
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
					exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
 | 
				
			||||||
    const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
 | 
					    const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
 | 
				
			||||||
    if (!stdOut) {
 | 
					    if (!stdOut) {
 | 
				
			||||||
        throw new Error(`Could not get cache folder path for ${packageManager}`);
 | 
					        throw new Error(`Could not get cache folder path for ${packageManager}`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    core.debug(`${packageManager} path is ${stdOut}`);
 | 
					    core.debug(`${packageManager} path is ${stdOut}`);
 | 
				
			||||||
    return stdOut;
 | 
					    return stdOut;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
function isGhes() {
 | 
					function isGhes() {
 | 
				
			||||||
    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
 | 
					    const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
 | 
				
			||||||
    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
 | 
					    return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.isGhes = isGhes;
 | 
					exports.isGhes = isGhes;
 | 
				
			||||||
function isCacheFeatureAvailable() {
 | 
					function isCacheFeatureAvailable() {
 | 
				
			||||||
    if (!cache.isFeatureAvailable()) {
 | 
					    if (!cache.isFeatureAvailable()) {
 | 
				
			||||||
        if (isGhes()) {
 | 
					        if (isGhes()) {
 | 
				
			||||||
            throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
 | 
					            throw new Error('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
            core.warning('The runner was not able to contact the cache service. Caching will be skipped');
 | 
					            core.warning('The runner was not able to contact the cache service. Caching will be skipped');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
 | 
					exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
@@ -60014,23 +60014,23 @@ exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
 | 
				
			|||||||
/***/ ((__unused_webpack_module, exports) => {
 | 
					/***/ ((__unused_webpack_module, exports) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
					Object.defineProperty(exports, "__esModule", ({ value: true }));
 | 
				
			||||||
var LockType;
 | 
					var LockType;
 | 
				
			||||||
(function (LockType) {
 | 
					(function (LockType) {
 | 
				
			||||||
    LockType["Npm"] = "npm";
 | 
					    LockType["Npm"] = "npm";
 | 
				
			||||||
    LockType["Pnpm"] = "pnpm";
 | 
					    LockType["Pnpm"] = "pnpm";
 | 
				
			||||||
    LockType["Yarn"] = "yarn";
 | 
					    LockType["Yarn"] = "yarn";
 | 
				
			||||||
})(LockType = exports.LockType || (exports.LockType = {}));
 | 
					})(LockType = exports.LockType || (exports.LockType = {}));
 | 
				
			||||||
var State;
 | 
					var State;
 | 
				
			||||||
(function (State) {
 | 
					(function (State) {
 | 
				
			||||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
					    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
				
			||||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
					    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
				
			||||||
})(State = exports.State || (exports.State = {}));
 | 
					})(State = exports.State || (exports.State = {}));
 | 
				
			||||||
var Outputs;
 | 
					var Outputs;
 | 
				
			||||||
(function (Outputs) {
 | 
					(function (Outputs) {
 | 
				
			||||||
    Outputs["CacheHit"] = "cache-hit";
 | 
					    Outputs["CacheHit"] = "cache-hit";
 | 
				
			||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
					})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***/ }),
 | 
					/***/ }),
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1466
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1466
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										17
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.ts
									
									
									
									
									
								
							@@ -65,7 +65,9 @@ export async function run() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function resolveVersionInput(): string {
 | 
					function resolveVersionInput(): string {
 | 
				
			||||||
  let version = core.getInput('node-version');
 | 
					  let version = core.getInput('node-version');
 | 
				
			||||||
  const versionFileInput = core.getInput('node-version-file');
 | 
					  const nodeVersionFile = core.getInput('node-version-file');
 | 
				
			||||||
 | 
					  const versionFileInput =
 | 
				
			||||||
 | 
					    nodeVersionFile === 'volta' ? 'package.json' : nodeVersionFile;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (version && versionFileInput) {
 | 
					  if (version && versionFileInput) {
 | 
				
			||||||
    core.warning(
 | 
					    core.warning(
 | 
				
			||||||
@@ -82,14 +84,21 @@ function resolveVersionInput(): string {
 | 
				
			|||||||
      process.env.GITHUB_WORKSPACE!,
 | 
					      process.env.GITHUB_WORKSPACE!,
 | 
				
			||||||
      versionFileInput
 | 
					      versionFileInput
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!fs.existsSync(versionFilePath)) {
 | 
					    if (!fs.existsSync(versionFilePath)) {
 | 
				
			||||||
      throw new Error(
 | 
					      throw new Error(
 | 
				
			||||||
        `The specified node version file at: ${versionFilePath} does not exist`
 | 
					        `The specified node version file at: ${versionFilePath} does not exist`
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    version = installer.parseNodeVersionFile(
 | 
					
 | 
				
			||||||
      fs.readFileSync(versionFilePath, 'utf8')
 | 
					    if (nodeVersionFile === 'volta') {
 | 
				
			||||||
    );
 | 
					      version = JSON.parse(fs.readFileSync(versionFilePath, 'utf8')).volta.node;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      version = installer.parseNodeVersionFile(
 | 
				
			||||||
 | 
					          fs.readFileSync(versionFilePath, 'utf8')
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    core.info(`Resolved ${versionFileInput} as ${version}`);
 | 
					    core.info(`Resolved ${versionFileInput} as ${version}`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@
 | 
				
			|||||||
    "rootDir": "./src",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
 | 
					    "rootDir": "./src",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
 | 
				
			||||||
    "sourceMap": true,
 | 
					    "sourceMap": true,
 | 
				
			||||||
    "strict": true,                           /* Enable all strict type-checking options. */
 | 
					    "strict": true,                           /* Enable all strict type-checking options. */
 | 
				
			||||||
    "noImplicitAny": false,                 /* Raise error on expressions and declarations with an implied 'any' type. */
 | 
					    "noImplicitAny": false,                   /* Raise error on expressions and declarations with an implied 'any' type. */
 | 
				
			||||||
    "esModuleInterop": true                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
 | 
					    "esModuleInterop": true                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "exclude": ["__tests__", "lib", "node_modules"]
 | 
					  "exclude": ["__tests__", "lib", "node_modules"]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user