Switch to pnpm store path command
parent
f452812b44
commit
3af302a4f2
|
@ -55,18 +55,20 @@ steps:
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
**Caching pnpm dependencies:**
|
**Caching pnpm (v6.10+) dependencies:**
|
||||||
```yaml
|
```yaml
|
||||||
# This workflow uses actions that are not certified by GitHub.
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
# They are provided by a third-party and are governed by
|
# They are provided by a third-party and are governed by
|
||||||
# separate terms of service, privacy policy, and support
|
# separate terms of service, privacy policy, and support
|
||||||
# documentation.
|
# documentation.
|
||||||
|
|
||||||
|
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
||||||
with:
|
with:
|
||||||
version: 6.9.0
|
version: 6.10.0
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '14'
|
||||||
|
|
|
@ -4282,14 +4282,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const os_1 = __importDefault(__webpack_require__(87));
|
|
||||||
const path_1 = __importDefault(__webpack_require__(622));
|
|
||||||
exports.supportedPackageManagers = {
|
exports.supportedPackageManagers = {
|
||||||
npm: {
|
npm: {
|
||||||
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
||||||
|
@ -4297,8 +4292,7 @@ exports.supportedPackageManagers = {
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderCommand: 'pnpm get store',
|
getCacheFolderCommand: 'pnpm store path'
|
||||||
defaultCacheFolder: path_1.default.join(os_1.default.homedir(), '.pnpm-store')
|
|
||||||
},
|
},
|
||||||
yarn1: {
|
yarn1: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
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* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const 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;
|
|
||||||
}
|
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51580,14 +51580,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const os_1 = __importDefault(__webpack_require__(87));
|
|
||||||
const path_1 = __importDefault(__webpack_require__(622));
|
|
||||||
exports.supportedPackageManagers = {
|
exports.supportedPackageManagers = {
|
||||||
npm: {
|
npm: {
|
||||||
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
lockFilePatterns: ['package-lock.json', 'yarn.lock'],
|
||||||
|
@ -51595,8 +51590,7 @@ exports.supportedPackageManagers = {
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderCommand: 'pnpm get store',
|
getCacheFolderCommand: 'pnpm store path'
|
||||||
defaultCacheFolder: path_1.default.join(os_1.default.homedir(), '.pnpm-store')
|
|
||||||
},
|
},
|
||||||
yarn1: {
|
yarn1: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
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* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo, packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let stdOut = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const 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;
|
|
||||||
}
|
|
||||||
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}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ type SupportedPackageManagers = {
|
||||||
export interface PackageManagerInfo {
|
export interface PackageManagerInfo {
|
||||||
lockFilePatterns: Array<string>;
|
lockFilePatterns: Array<string>;
|
||||||
getCacheFolderCommand: string;
|
getCacheFolderCommand: string;
|
||||||
defaultCacheFolder?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const supportedPackageManagers: SupportedPackageManagers = {
|
export const supportedPackageManagers: SupportedPackageManagers = {
|
||||||
|
@ -20,8 +19,7 @@ export const supportedPackageManagers: SupportedPackageManagers = {
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
lockFilePatterns: ['pnpm-lock.yaml'],
|
lockFilePatterns: ['pnpm-lock.yaml'],
|
||||||
getCacheFolderCommand: 'pnpm get store',
|
getCacheFolderCommand: 'pnpm store path'
|
||||||
defaultCacheFolder: path.join(os.homedir(), '.pnpm-store')
|
|
||||||
},
|
},
|
||||||
yarn1: {
|
yarn1: {
|
||||||
lockFilePatterns: ['yarn.lock'],
|
lockFilePatterns: ['yarn.lock'],
|
||||||
|
@ -80,16 +78,9 @@ export const getCacheDirectoryPath = async (
|
||||||
packageManagerInfo: PackageManagerInfo,
|
packageManagerInfo: PackageManagerInfo,
|
||||||
packageManager: string
|
packageManager: string
|
||||||
) => {
|
) => {
|
||||||
let stdOut = await getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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}`);
|
||||||
|
|
Loading…
Reference in New Issue