1
0
Fork 0
mirror of https://github.com/actions/setup-node synced 2024-12-22 13:12:43 +00:00

Switch to pnpm store path command

This commit is contained in:
Jacob Gillespie 2021-07-15 12:43:19 +01:00
parent f452812b44
commit 3af302a4f2
No known key found for this signature in database
GPG key ID: 52D71192EF3DBDD9
4 changed files with 12 additions and 45 deletions

View file

@ -55,18 +55,20 @@ steps:
- run: npm test
```
**Caching pnpm dependencies:**
**Caching pnpm (v6.10+) dependencies:**
```yaml
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 6.9.0
version: 6.10.0
- uses: actions/setup-node@v2
with:
node-version: '14'

View file

@ -4282,14 +4282,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const os_1 = __importDefault(__webpack_require__(87));
const path_1 = __importDefault(__webpack_require__(622));
exports.supportedPackageManagers = {
npm: {
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
@ -4297,8 +4292,7 @@ exports.supportedPackageManagers = {
},
pnpm: {
lockFilePatterns: ['pnpm-lock.yaml'],
getCacheFolderCommand: 'pnpm get store',
defaultCacheFolder: path_1.default.join(os_1.default.homedir(), '.pnpm-store')
getCacheFolderCommand: 'pnpm store path'
},
yarn1: {
lockFilePatterns: ['yarn.lock'],
@ -4345,14 +4339,7 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
}
});
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
let stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
// pnpm returns 'undefined' if no custom store path is set
if (stdOut === 'undefined') {
stdOut = '';
}
if (!stdOut && packageManagerInfo.defaultCacheFolder) {
stdOut = packageManagerInfo.defaultCacheFolder;
}
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
if (!stdOut) {
throw new Error(`Could not get cache folder path for ${packageManager}`);
}

17
dist/setup/index.js vendored
View file

@ -51580,14 +51580,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec = __importStar(__webpack_require__(986));
const os_1 = __importDefault(__webpack_require__(87));
const path_1 = __importDefault(__webpack_require__(622));
exports.supportedPackageManagers = {
npm: {
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
@ -51595,8 +51590,7 @@ exports.supportedPackageManagers = {
},
pnpm: {
lockFilePatterns: ['pnpm-lock.yaml'],
getCacheFolderCommand: 'pnpm get store',
defaultCacheFolder: path_1.default.join(os_1.default.homedir(), '.pnpm-store')
getCacheFolderCommand: 'pnpm store path'
},
yarn1: {
lockFilePatterns: ['yarn.lock'],
@ -51643,14 +51637,7 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
}
});
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
let stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
// pnpm returns 'undefined' if no custom store path is set
if (stdOut === 'undefined') {
stdOut = '';
}
if (!stdOut && packageManagerInfo.defaultCacheFolder) {
stdOut = packageManagerInfo.defaultCacheFolder;
}
const stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
if (!stdOut) {
throw new Error(`Could not get cache folder path for ${packageManager}`);
}

View file

@ -10,7 +10,6 @@ type SupportedPackageManagers = {
export interface PackageManagerInfo {
lockFilePatterns: Array<string>;
getCacheFolderCommand: string;
defaultCacheFolder?: string;
}
export const supportedPackageManagers: SupportedPackageManagers = {
@ -20,8 +19,7 @@ export const supportedPackageManagers: SupportedPackageManagers = {
},
pnpm: {
lockFilePatterns: ['pnpm-lock.yaml'],
getCacheFolderCommand: 'pnpm get store',
defaultCacheFolder: path.join(os.homedir(), '.pnpm-store')
getCacheFolderCommand: 'pnpm store path'
},
yarn1: {
lockFilePatterns: ['yarn.lock'],
@ -80,16 +78,9 @@ export const getCacheDirectoryPath = async (
packageManagerInfo: PackageManagerInfo,
packageManager: string
) => {
let stdOut = await getCommandOutput(packageManagerInfo.getCacheFolderCommand);
// pnpm returns 'undefined' if no custom store path is set
if (stdOut === 'undefined') {
stdOut = '';
}
if (!stdOut && packageManagerInfo.defaultCacheFolder) {
stdOut = packageManagerInfo.defaultCacheFolder;
}
const stdOut = await getCommandOutput(
packageManagerInfo.getCacheFolderCommand
);
if (!stdOut) {
throw new Error(`Could not get cache folder path for ${packageManager}`);