mirror of
https://github.com/actions/setup-node
synced 2025-04-18 22:23:11 +00:00
Fix find lock file
This commit is contained in:
parent
318f863611
commit
086599f868
7
dist/cache-save/index.js
vendored
7
dist/cache-save/index.js
vendored
@ -59248,7 +59248,7 @@ 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 }));
|
||||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getPackageManagerWorkingDir = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||||
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));
|
||||||
@ -59294,8 +59294,9 @@ const getPackageManagerWorkingDir = () => {
|
|||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
return cacheDependencyPath ? path_1.default.dirname(cacheDependencyPath) : null;
|
return cacheDependencyPath ? path_1.default.dirname(cacheDependencyPath) : null;
|
||||||
};
|
};
|
||||||
|
exports.getPackageManagerWorkingDir = getPackageManagerWorkingDir;
|
||||||
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}`, getPackageManagerWorkingDir());
|
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`, exports.getPackageManagerWorkingDir());
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||||
}
|
}
|
||||||
@ -59324,7 +59325,7 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
|||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||||
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand, getPackageManagerWorkingDir());
|
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand, exports.getPackageManagerWorkingDir());
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
9
dist/setup/index.js
vendored
9
dist/setup/index.js
vendored
@ -71167,7 +71167,7 @@ const restoreCache = (packageManager, cacheDependencyPath) => __awaiter(void 0,
|
|||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
const findLockFile = (packageManager) => {
|
const findLockFile = (packageManager) => {
|
||||||
const lockFiles = packageManager.lockFilePatterns;
|
const lockFiles = packageManager.lockFilePatterns;
|
||||||
const workspace = process.env.GITHUB_WORKSPACE;
|
const workspace = cache_utils_1.getPackageManagerWorkingDir() || process.env.GITHUB_WORKSPACE;
|
||||||
const rootContent = fs_1.default.readdirSync(workspace);
|
const rootContent = fs_1.default.readdirSync(workspace);
|
||||||
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
||||||
if (!lockFile) {
|
if (!lockFile) {
|
||||||
@ -71216,7 +71216,7 @@ 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 }));
|
||||||
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.isCacheFeatureAvailable = exports.isGhes = exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getPackageManagerWorkingDir = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
||||||
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));
|
||||||
@ -71262,8 +71262,9 @@ const getPackageManagerWorkingDir = () => {
|
|||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
return cacheDependencyPath ? path_1.default.dirname(cacheDependencyPath) : null;
|
return cacheDependencyPath ? path_1.default.dirname(cacheDependencyPath) : null;
|
||||||
};
|
};
|
||||||
|
exports.getPackageManagerWorkingDir = getPackageManagerWorkingDir;
|
||||||
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}`, getPackageManagerWorkingDir());
|
const stdOut = yield exports.getCommandOutput(`${packageManager} ${command}`, exports.getPackageManagerWorkingDir());
|
||||||
if (!stdOut) {
|
if (!stdOut) {
|
||||||
throw new Error(`Could not retrieve version of ${packageManager}`);
|
throw new Error(`Could not retrieve version of ${packageManager}`);
|
||||||
}
|
}
|
||||||
@ -71292,7 +71293,7 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void
|
|||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = getPackageManagerInfo;
|
exports.getPackageManagerInfo = getPackageManagerInfo;
|
||||||
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
const getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand, getPackageManagerWorkingDir());
|
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand, exports.getPackageManagerWorkingDir());
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import {State} from './constants';
|
|||||||
import {
|
import {
|
||||||
getCacheDirectoryPath,
|
getCacheDirectoryPath,
|
||||||
getPackageManagerInfo,
|
getPackageManagerInfo,
|
||||||
|
getPackageManagerWorkingDir,
|
||||||
PackageManagerInfo
|
PackageManagerInfo
|
||||||
} from './cache-utils';
|
} from './cache-utils';
|
||||||
|
|
||||||
@ -55,7 +56,8 @@ export const restoreCache = async (
|
|||||||
|
|
||||||
const findLockFile = (packageManager: PackageManagerInfo) => {
|
const findLockFile = (packageManager: PackageManagerInfo) => {
|
||||||
const lockFiles = packageManager.lockFilePatterns;
|
const lockFiles = packageManager.lockFilePatterns;
|
||||||
const workspace = process.env.GITHUB_WORKSPACE!;
|
const workspace =
|
||||||
|
getPackageManagerWorkingDir() || process.env.GITHUB_WORKSPACE!;
|
||||||
const rootContent = fs.readdirSync(workspace);
|
const rootContent = fs.readdirSync(workspace);
|
||||||
|
|
||||||
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
const lockFile = lockFiles.find(item => rootContent.includes(item));
|
||||||
|
@ -51,7 +51,7 @@ export const getCommandOutput = async (
|
|||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPackageManagerWorkingDir = (): string | null => {
|
export const getPackageManagerWorkingDir = (): string | null => {
|
||||||
const projectDir = core.getInput('project-dir');
|
const projectDir = core.getInput('project-dir');
|
||||||
if (projectDir) {
|
if (projectDir) {
|
||||||
return projectDir;
|
return projectDir;
|
||||||
|
Loading…
Reference in New Issue
Block a user