mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Type check safe-chain package
This commit is contained in:
parent
d5dc801c00
commit
c88b1a624f
60 changed files with 1179 additions and 33 deletions
|
|
@ -2,8 +2,14 @@ import { ui } from "../../environment/userInteraction.js";
|
|||
import { safeSpawn } from "../../utils/safeSpawn.js";
|
||||
import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js";
|
||||
|
||||
/**
|
||||
* @param {string[]} args
|
||||
*
|
||||
* @returns {Promise<{status: number}>}
|
||||
*/
|
||||
export async function runYarnCommand(args) {
|
||||
try {
|
||||
// @ts-expect-error values of process.env can be string | undefined
|
||||
const env = mergeSafeChainProxyEnvironmentVariables(process.env);
|
||||
await fixYarnProxyEnvironmentVariables(env);
|
||||
|
||||
|
|
@ -12,7 +18,7 @@ export async function runYarnCommand(args) {
|
|||
env,
|
||||
});
|
||||
return { status: result.status };
|
||||
} catch (error) {
|
||||
} catch (/** @type any */ error) {
|
||||
if (error.status) {
|
||||
return { status: error.status };
|
||||
} else {
|
||||
|
|
@ -22,6 +28,11 @@ export async function runYarnCommand(args) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Record<string, string>} env
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async function fixYarnProxyEnvironmentVariables(env) {
|
||||
// Yarn ignores standard proxy environment variable HTTPS_PROXY
|
||||
// It does respect NODE_EXTRA_CA_CERTS for custom CA certificates though.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue