@vercel/build-utils 5.4.0 → 5.4.1
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/dist/fs/run-user-scripts.d.ts +8 -4
- package/dist/fs/run-user-scripts.js +14 -17
- package/dist/index.js +14 -17
- package/package.json +2 -2
@@ -8,8 +8,7 @@ export interface ScanParentDirsResult {
|
|
8
8
|
*/
|
9
9
|
cliType: CliType;
|
10
10
|
/**
|
11
|
-
* The file path of found `package.json` file, or `undefined` if
|
12
|
-
* found.
|
11
|
+
* The file path of found `package.json` file, or `undefined` if not found.
|
13
12
|
*/
|
14
13
|
packageJsonPath?: string;
|
15
14
|
/**
|
@@ -18,8 +17,13 @@ export interface ScanParentDirsResult {
|
|
18
17
|
*/
|
19
18
|
packageJson?: PackageJson;
|
20
19
|
/**
|
21
|
-
* The
|
22
|
-
*
|
20
|
+
* The file path of the lockfile (`yarn.lock`, `package-lock.json`, or `pnpm-lock.yaml`)
|
21
|
+
* or `undefined` if not found.
|
22
|
+
*/
|
23
|
+
lockfilePath?: string;
|
24
|
+
/**
|
25
|
+
* The `lockfileVersion` number from lockfile (`package-lock.json` or `pnpm-lock.yaml`),
|
26
|
+
* or `undefined` if not found.
|
23
27
|
*/
|
24
28
|
lockfileVersion?: number;
|
25
29
|
}
|
@@ -95,21 +95,9 @@ async function execCommand(command, options = {}) {
|
|
95
95
|
}
|
96
96
|
exports.execCommand = execCommand;
|
97
97
|
async function getNodeBinPath({ cwd, }) {
|
98
|
-
const {
|
99
|
-
|
100
|
-
|
101
|
-
// in some rare cases, we saw `npm bin` exit with a non-0 code, but still
|
102
|
-
// output the right bin path, so we ignore the exit code
|
103
|
-
ignoreNon0Exit: true,
|
104
|
-
});
|
105
|
-
const nodeBinPath = stdout.trim();
|
106
|
-
if (path_1.default.isAbsolute(nodeBinPath)) {
|
107
|
-
return nodeBinPath;
|
108
|
-
}
|
109
|
-
throw new errors_1.NowBuildError({
|
110
|
-
code: `BUILD_UTILS_GET_NODE_BIN_PATH`,
|
111
|
-
message: `Running \`npm bin\` failed to return a valid bin path (code=${code}, stdout=${stdout}, stderr=${stderr})`,
|
112
|
-
});
|
98
|
+
const { lockfilePath } = await scanParentDirs(cwd);
|
99
|
+
const dir = path_1.default.dirname(lockfilePath || cwd);
|
100
|
+
return path_1.default.join(dir, 'node_modules', '.bin');
|
113
101
|
}
|
114
102
|
exports.getNodeBinPath = getNodeBinPath;
|
115
103
|
async function chmodPlusX(fsPath) {
|
@@ -202,6 +190,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
202
190
|
start: destPath,
|
203
191
|
filenames: ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml'],
|
204
192
|
});
|
193
|
+
let lockfilePath;
|
205
194
|
let lockfileVersion;
|
206
195
|
let cliType = 'yarn';
|
207
196
|
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
|
@@ -216,18 +205,26 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
216
205
|
// Priority order is Yarn > pnpm > npm
|
217
206
|
if (hasYarnLock) {
|
218
207
|
cliType = 'yarn';
|
208
|
+
lockfilePath = yarnLockPath;
|
219
209
|
}
|
220
210
|
else if (pnpmLockYaml) {
|
221
211
|
cliType = 'pnpm';
|
222
|
-
|
212
|
+
lockfilePath = pnpmLockPath;
|
223
213
|
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
224
214
|
}
|
225
215
|
else if (packageLockJson) {
|
226
216
|
cliType = 'npm';
|
217
|
+
lockfilePath = npmLockPath;
|
227
218
|
lockfileVersion = packageLockJson.lockfileVersion;
|
228
219
|
}
|
229
220
|
const packageJsonPath = pkgJsonPath || undefined;
|
230
|
-
return {
|
221
|
+
return {
|
222
|
+
cliType,
|
223
|
+
packageJson,
|
224
|
+
lockfilePath,
|
225
|
+
lockfileVersion,
|
226
|
+
packageJsonPath,
|
227
|
+
};
|
231
228
|
}
|
232
229
|
exports.scanParentDirs = scanParentDirs;
|
233
230
|
async function walkParentDirs({ base, start, filename, }) {
|
package/dist/index.js
CHANGED
@@ -30927,21 +30927,9 @@ async function execCommand(command, options = {}) {
|
|
30927
30927
|
}
|
30928
30928
|
exports.execCommand = execCommand;
|
30929
30929
|
async function getNodeBinPath({ cwd, }) {
|
30930
|
-
const {
|
30931
|
-
|
30932
|
-
|
30933
|
-
// in some rare cases, we saw `npm bin` exit with a non-0 code, but still
|
30934
|
-
// output the right bin path, so we ignore the exit code
|
30935
|
-
ignoreNon0Exit: true,
|
30936
|
-
});
|
30937
|
-
const nodeBinPath = stdout.trim();
|
30938
|
-
if (path_1.default.isAbsolute(nodeBinPath)) {
|
30939
|
-
return nodeBinPath;
|
30940
|
-
}
|
30941
|
-
throw new errors_1.NowBuildError({
|
30942
|
-
code: `BUILD_UTILS_GET_NODE_BIN_PATH`,
|
30943
|
-
message: `Running \`npm bin\` failed to return a valid bin path (code=${code}, stdout=${stdout}, stderr=${stderr})`,
|
30944
|
-
});
|
30930
|
+
const { lockfilePath } = await scanParentDirs(cwd);
|
30931
|
+
const dir = path_1.default.dirname(lockfilePath || cwd);
|
30932
|
+
return path_1.default.join(dir, 'node_modules', '.bin');
|
30945
30933
|
}
|
30946
30934
|
exports.getNodeBinPath = getNodeBinPath;
|
30947
30935
|
async function chmodPlusX(fsPath) {
|
@@ -31034,6 +31022,7 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
31034
31022
|
start: destPath,
|
31035
31023
|
filenames: ['yarn.lock', 'package-lock.json', 'pnpm-lock.yaml'],
|
31036
31024
|
});
|
31025
|
+
let lockfilePath;
|
31037
31026
|
let lockfileVersion;
|
31038
31027
|
let cliType = 'yarn';
|
31039
31028
|
const [hasYarnLock, packageLockJson, pnpmLockYaml] = await Promise.all([
|
@@ -31048,18 +31037,26 @@ async function scanParentDirs(destPath, readPackageJson = false) {
|
|
31048
31037
|
// Priority order is Yarn > pnpm > npm
|
31049
31038
|
if (hasYarnLock) {
|
31050
31039
|
cliType = 'yarn';
|
31040
|
+
lockfilePath = yarnLockPath;
|
31051
31041
|
}
|
31052
31042
|
else if (pnpmLockYaml) {
|
31053
31043
|
cliType = 'pnpm';
|
31054
|
-
|
31044
|
+
lockfilePath = pnpmLockPath;
|
31055
31045
|
lockfileVersion = Number(pnpmLockYaml.lockfileVersion);
|
31056
31046
|
}
|
31057
31047
|
else if (packageLockJson) {
|
31058
31048
|
cliType = 'npm';
|
31049
|
+
lockfilePath = npmLockPath;
|
31059
31050
|
lockfileVersion = packageLockJson.lockfileVersion;
|
31060
31051
|
}
|
31061
31052
|
const packageJsonPath = pkgJsonPath || undefined;
|
31062
|
-
return {
|
31053
|
+
return {
|
31054
|
+
cliType,
|
31055
|
+
packageJson,
|
31056
|
+
lockfilePath,
|
31057
|
+
lockfileVersion,
|
31058
|
+
packageJsonPath,
|
31059
|
+
};
|
31063
31060
|
}
|
31064
31061
|
exports.scanParentDirs = scanParentDirs;
|
31065
31062
|
async function walkParentDirs({ base, start, filename, }) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vercel/build-utils",
|
3
|
-
"version": "5.4.
|
3
|
+
"version": "5.4.1",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"typescript": "4.3.4",
|
48
48
|
"yazl": "2.5.1"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "2906d83eaeddc72f9d874981dbe6698e812f3ca3"
|
51
51
|
}
|