@vercel/build-utils
Advanced tools
Comparing version 5.9.0 to 6.0.0
@@ -59,7 +59,2 @@ /// <reference types="node" /> | ||
export declare function spawnAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<void>; | ||
export declare function execAsync(command: string, args: string[], opts?: SpawnOptionsExtended): Promise<{ | ||
stdout: string; | ||
stderr: string; | ||
code: number; | ||
}>; | ||
export declare function spawnCommand(command: string, options?: SpawnOptions): import("child_process").ChildProcess; | ||
@@ -66,0 +61,0 @@ export declare function execCommand(command: string, options?: SpawnOptions): Promise<boolean>; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.installDependencies = exports.getScriptName = exports.runPipInstall = exports.runBundleInstall = exports.runPackageJsonScript = exports.runCustomInstallCommand = exports.getEnvForPackageManager = exports.runNpmInstall = exports.walkParentDirs = exports.scanParentDirs = exports.getNodeVersion = exports.getSpawnOptions = exports.runShellScript = exports.getNodeBinPath = exports.execCommand = exports.spawnCommand = exports.execAsync = exports.spawnAsync = void 0; | ||
exports.installDependencies = exports.getScriptName = exports.runPipInstall = exports.runBundleInstall = exports.runPackageJsonScript = exports.runCustomInstallCommand = exports.getEnvForPackageManager = exports.runNpmInstall = exports.walkParentDirs = exports.scanParentDirs = exports.getNodeVersion = exports.getSpawnOptions = exports.runShellScript = exports.getNodeBinPath = exports.execCommand = exports.spawnCommand = exports.spawnAsync = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
@@ -48,37 +48,2 @@ const fs_extra_1 = __importDefault(require("fs-extra")); | ||
exports.spawnAsync = spawnAsync; | ||
function execAsync(command, args, opts = {}) { | ||
return new Promise((resolve, reject) => { | ||
opts.stdio = 'pipe'; | ||
const stdoutList = []; | ||
const stderrList = []; | ||
const child = cross_spawn_1.default(command, args, opts); | ||
child.stderr.on('data', data => { | ||
stderrList.push(data); | ||
}); | ||
child.stdout.on('data', data => { | ||
stdoutList.push(data); | ||
}); | ||
child.on('error', reject); | ||
child.on('close', (code, signal) => { | ||
if (code === 0 || opts.ignoreNon0Exit) { | ||
return resolve({ | ||
// ignoring the next line due to do some Node.js type issue when we removed hoisting of dependencies in https://github.com/vercel/vercel/pull/9198 | ||
// should eventually be fixed when this method is remove by https://github.com/vercel/vercel/pull/9200 or we update to Node 16 | ||
// @ts-ignore | ||
code, | ||
stdout: Buffer.concat(stdoutList).toString(), | ||
stderr: Buffer.concat(stderrList).toString(), | ||
}); | ||
} | ||
const cmd = opts.prettyCommand | ||
? `Command "${opts.prettyCommand}"` | ||
: 'Command'; | ||
return reject(new errors_1.NowBuildError({ | ||
code: `BUILD_UTILS_EXEC_${code || signal}`, | ||
message: `${cmd} exited with ${code || signal}`, | ||
})); | ||
}); | ||
}); | ||
} | ||
exports.execAsync = execAsync; | ||
function spawnCommand(command, options = {}) { | ||
@@ -85,0 +50,0 @@ const opts = { ...options, prettyCommand: command }; |
@@ -11,3 +11,3 @@ import FileBlob from './file-blob'; | ||
import rename from './fs/rename'; | ||
import { execAsync, spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getSpawnOptions, getNodeBinPath, scanParentDirs } from './fs/run-user-scripts'; | ||
import { spawnAsync, execCommand, spawnCommand, walkParentDirs, getScriptName, installDependencies, runPackageJsonScript, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getSpawnOptions, getNodeBinPath, scanParentDirs } from './fs/run-user-scripts'; | ||
import { getLatestNodeVersion, getDiscontinuedNodeVersions } from './fs/node-version'; | ||
@@ -20,3 +20,3 @@ import streamToBuffer from './fs/stream-to-buffer'; | ||
import { cloneEnv } from './clone-env'; | ||
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, execAsync, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, }; | ||
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, }; | ||
export { EdgeFunction } from './edge-function'; | ||
@@ -23,0 +23,0 @@ export { readConfigFile } from './fs/read-config-file'; |
{ | ||
"name": "@vercel/build-utils", | ||
"version": "5.9.0", | ||
"version": "6.0.0", | ||
"license": "MIT", | ||
@@ -54,3 +54,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "4ccdcde463560dc44da89edf52523419fc56ab62" | ||
"gitHead": "25f6595d3698546ba69c7fe9f601a906167fef3f" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1534220
31478