MCPcopy Create free account
hub / github.com/vercel/vercel / execVercelCli

Function execVercelCli

packages/cli-exec/src/exec.ts:37–59  ·  view source on GitHub ↗
(
  args: string[],
  options: ExecVercelCliOptions = {}
)

Source from the content-addressed store, hash-verified

35 * caller passes a sanitized `PATH`.
36 */
37export async function execVercelCli(
38 args: string[],
39 options: ExecVercelCliOptions = {}
40): Promise<ExecVercelCliResult> {
41 const cwd = path.resolve(options.cwd ?? process.cwd());
42 await assertValidCwd(cwd);
43 const env = mergeExecEnv(options.env);
44 const pathValue = getEnvPath(env);
45
46 try {
47 return await execResolvedVercelCli(args, options, cwd, env, pathValue);
48 } catch (error) {
49 if (
50 error instanceof VercelCliError &&
51 error.code === 'VERCEL_CLI_NOT_FOUND'
52 ) {
53 clearCachedCliInvocation(cwd, pathValue);
54 return await execResolvedVercelCli(args, options, cwd, env, pathValue);
55 }
56
57 throw error;
58 }
59}
60
61/**
62 * Resolves one CLI invocation and executes it once.

Callers 2

index.test.tsFile · 0.85

Calls 7

assertValidCwdFunction · 0.90
getEnvPathFunction · 0.90
clearCachedCliInvocationFunction · 0.90
mergeExecEnvFunction · 0.85
execResolvedVercelCliFunction · 0.85
cwdMethod · 0.80
resolveMethod · 0.45

Tested by

no test coverage detected