mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
20 lines
634 B
JavaScript
20 lines
634 B
JavaScript
import { safeSpawn } from "../../utils/safeSpawn.js";
|
|
import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js";
|
|
import { reportCommandExecutionFailure } from "../_shared/commandErrors.js";
|
|
|
|
/**
|
|
* @param {string[]} args
|
|
*
|
|
* @returns {Promise<{status: number}>}
|
|
*/
|
|
export async function runNpm(args) {
|
|
try {
|
|
const result = await safeSpawn("npm", args, {
|
|
stdio: "inherit",
|
|
env: mergeSafeChainProxyEnvironmentVariables(process.env),
|
|
});
|
|
return { status: result.status };
|
|
} catch (/** @type any */ error) {
|
|
return reportCommandExecutionFailure(error, "npm");
|
|
}
|
|
}
|