@vercel/build-utils 2.14.1-canary.2 → 2.14.1-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/fs/run-user-scripts.d.ts +2 -2
- package/dist/fs/run-user-scripts.js +18 -3
- package/dist/index.js +18 -3
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { SpawnOptions } from 'child_process';
|
3
3
|
import { Meta, PackageJson, NodeVersion, Config } from '../types';
|
4
|
-
export declare type CliType = 'yarn' | 'npm';
|
4
|
+
export declare type CliType = 'yarn' | 'npm' | 'pnpm';
|
5
5
|
export interface ScanParentDirsResult {
|
6
6
|
/**
|
7
|
-
* "yarn"
|
7
|
+
* "yarn", "npm", or "pnpm" depending on the presence of lockfiles.
|
8
8
|
*/
|
9
9
|
cliType: CliType;
|
10
10
|
/**
|
@@ -12,6 +12,7 @@ const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
12
12
|
const util_1 = require("util");
|
13
13
|
const errors_1 = require("../errors");
|
14
14
|
const node_version_1 = require("./node-version");
|
15
|
+
const read_config_file_1 = require("./read-config-file");
|
15
16
|
function spawnAsync(command, args, opts = {}) {
|
16
17
|
return new Promise((resolve, reject) => {
|
17
18
|
const stderrLogs = [];
|
@@ -164,7 +165,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
164
165
|
packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
|
165
166
|
}
|
166
167
|
// eslint-disable-next-line no-await-in-loop
|
167
|
-
const [packageLockJson, hasYarnLock] = await Promise.all([
|
168
|
+
const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
|
168
169
|
fs_extra_1.default
|
169
170
|
.readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
|
170
171
|
.catch(error => {
|
@@ -175,15 +176,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
175
176
|
throw error;
|
176
177
|
}),
|
177
178
|
fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
|
179
|
+
read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
|
178
180
|
]);
|
179
|
-
if (packageLockJson && !hasYarnLock) {
|
181
|
+
if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
|
180
182
|
cliType = 'npm';
|
181
183
|
lockfileVersion = packageLockJson.lockfileVersion;
|
182
184
|
}
|
185
|
+
if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
|
186
|
+
cliType = 'pnpm';
|
187
|
+
// just ensure that it is read as a number and not a string
|
188
|
+
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
189
|
+
}
|
183
190
|
// Only stop iterating if a lockfile was found, because it's possible
|
184
191
|
// that the lockfile is in a higher path than where the `package.json`
|
185
192
|
// file was found.
|
186
|
-
if (packageLockJson || hasYarnLock) {
|
193
|
+
if (packageLockJson || hasYarnLock || pnpmLockYaml) {
|
187
194
|
break;
|
188
195
|
}
|
189
196
|
}
|
@@ -234,6 +241,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
234
241
|
.filter(a => a !== '--prefer-offline')
|
235
242
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
236
243
|
}
|
244
|
+
else if (cliType === 'pnpm') {
|
245
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
246
|
+
// @see options https://pnpm.io/cli/install
|
247
|
+
opts.prettyCommand = 'pnpm install';
|
248
|
+
commandArgs = args
|
249
|
+
.filter(a => a !== '--prefer-offline')
|
250
|
+
.concat(['install', '--unsafe-perm']);
|
251
|
+
}
|
237
252
|
else {
|
238
253
|
opts.prettyCommand = 'yarn install';
|
239
254
|
commandArgs = ['install', ...args];
|
package/dist/index.js
CHANGED
@@ -34583,6 +34583,7 @@ const cross_spawn_1 = __importDefault(__webpack_require__(7618));
|
|
34583
34583
|
const util_1 = __webpack_require__(1669);
|
34584
34584
|
const errors_1 = __webpack_require__(3983);
|
34585
34585
|
const node_version_1 = __webpack_require__(7903);
|
34586
|
+
const read_config_file_1 = __webpack_require__(7792);
|
34586
34587
|
function spawnAsync(command, args, opts = {}) {
|
34587
34588
|
return new Promise((resolve, reject) => {
|
34588
34589
|
const stderrLogs = [];
|
@@ -34735,7 +34736,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
34735
34736
|
packageJson = JSON.parse(await fs_extra_1.default.readFile(packageJsonPath, 'utf8'));
|
34736
34737
|
}
|
34737
34738
|
// eslint-disable-next-line no-await-in-loop
|
34738
|
-
const [packageLockJson, hasYarnLock] = await Promise.all([
|
34739
|
+
const [packageLockJson, hasYarnLock, pnpmLockYaml] = await Promise.all([
|
34739
34740
|
fs_extra_1.default
|
34740
34741
|
.readJson(path_1.default.join(currentDestPath, 'package-lock.json'))
|
34741
34742
|
.catch(error => {
|
@@ -34746,15 +34747,21 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
34746
34747
|
throw error;
|
34747
34748
|
}),
|
34748
34749
|
fs_extra_1.default.pathExists(path_1.default.join(currentDestPath, 'yarn.lock')),
|
34750
|
+
read_config_file_1.readConfigFile(path_1.default.join(currentDestPath, 'pnpm-lock.yaml')),
|
34749
34751
|
]);
|
34750
|
-
if (packageLockJson && !hasYarnLock) {
|
34752
|
+
if (packageLockJson && !hasYarnLock && !pnpmLockYaml) {
|
34751
34753
|
cliType = 'npm';
|
34752
34754
|
lockfileVersion = packageLockJson.lockfileVersion;
|
34753
34755
|
}
|
34756
|
+
if (!packageLockJson && !hasYarnLock && pnpmLockYaml) {
|
34757
|
+
cliType = 'pnpm';
|
34758
|
+
// just ensure that it is read as a number and not a string
|
34759
|
+
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
34760
|
+
}
|
34754
34761
|
// Only stop iterating if a lockfile was found, because it's possible
|
34755
34762
|
// that the lockfile is in a higher path than where the `package.json`
|
34756
34763
|
// file was found.
|
34757
|
-
if (packageLockJson || hasYarnLock) {
|
34764
|
+
if (packageLockJson || hasYarnLock || pnpmLockYaml) {
|
34758
34765
|
break;
|
34759
34766
|
}
|
34760
34767
|
}
|
@@ -34805,6 +34812,14 @@ async function runNpmInstall(destPath, args = [], spawnOpts, meta, nodeVersion)
|
|
34805
34812
|
.filter(a => a !== '--prefer-offline')
|
34806
34813
|
.concat(['install', '--no-audit', '--unsafe-perm']);
|
34807
34814
|
}
|
34815
|
+
else if (cliType === 'pnpm') {
|
34816
|
+
// PNPM's install command is similar to NPM's but without the audit nonsense
|
34817
|
+
// @see options https://pnpm.io/cli/install
|
34818
|
+
opts.prettyCommand = 'pnpm install';
|
34819
|
+
commandArgs = args
|
34820
|
+
.filter(a => a !== '--prefer-offline')
|
34821
|
+
.concat(['install', '--unsafe-perm']);
|
34822
|
+
}
|
34808
34823
|
else {
|
34809
34824
|
opts.prettyCommand = 'yarn install';
|
34810
34825
|
commandArgs = ['install', ...args];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "2.14.1-canary.
|
3
|
+
"version": "2.14.1-canary.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"typescript": "4.3.4",
|
50
50
|
"yazl": "2.4.3"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "a17f3a96ec12483a28667894dcdc3bb57675ead3"
|
53
53
|
}
|