Skip to content

Modules | @vltpkg/run

Type Aliases

ExecOptions

type ExecOptions: SharedOptions & object;

Options for exec() and execFG()

Type declaration

arg0
arg0: string

the command to execute

Defined in

index.ts:120


RunExecOptions

type RunExecOptions: SharedOptions & object;

Options for runExec() and runExecFG()

Type declaration

arg0
arg0: string

Either the command to be executed, or the event to be run

packageJson?
optional packageJson: PackageJson;

pass in a @vltpkg/package-json.PackageJson instance, and it’ll be used for reading the package.json file. Optional, may improve performance somewhat.

Defined in

index.ts:128


RunFGResult

type RunFGResult: SpawnResultNoStdio & object;

Return type of runFG

Type declaration

post?
optional post: SpawnResultNoStdio;
pre?
optional pre: SpawnResultNoStdio;

Defined in

index.ts:161


RunOptions

type RunOptions: SharedOptions & object;

Options for run() and runFG()

Type declaration

arg0
arg0: string

the name of the thing in package.json#scripts

ignoreMissing?
optional ignoreMissing: boolean;

if the script is not defined in package.json#scripts, just ignore it and treat as success. Otherwise, treat as an error. Default false.

ignorePrePost?
optional ignorePrePost: boolean;

skip the pre/post commands, just run the one specified. This can be used to run JUST the specified script, without any pre/post commands.

manifest?
optional manifest: Manifest;

Pass in a manifest to avoid having to read it at all

packageJson?
optional packageJson: PackageJson;

pass in a @vltpkg/package-json.PackageJson instance, and it’ll be used for reading the package.json file. Optional, may improve performance somewhat.

Defined in

index.ts:88


RunResult

type RunResult: SpawnResultStdioStrings & object;

Return type of run

Type declaration

post?
optional post: SpawnResultStdioStrings;
pre?
optional pre: SpawnResultStdioStrings;

Defined in

index.ts:155


SharedOptions

type SharedOptions: PromiseSpawnOptions & object;

options shared by run() and exec()

Type declaration

args?
optional args: string[];

additional arguments to pass to the command

cwd
cwd: string

the directory where the package.json lives and the script runs

env?
optional env: NodeJS.ProcessEnv;

environment variables to set. process.env is always included, to omit fields, set them explicitly to undefined.

vlt will add some of its own, as well:

  • npm_lifecycle_event: the event name
  • npm_lifecycle_script: the command in package.json#scripts
  • npm_package_json: path to the package.json file
  • VLT_* envs for all vlt configuration values that are set
projectRoot
projectRoot: string

the root of the project, which we don’t walk up past

script-shell?
optional script-shell: boolean | string;

the shell to run the script in. If not set, then the default platform-specific shell will be used.

Defined in

index.ts:59

Functions

exec()

function exec(options): Promise<SpawnResultStdioStrings>

Execute an arbitrary command in the background

Parameters

options: ExecOptions

Returns

Promise<SpawnResultStdioStrings>

Defined in

index.ts:299


execFG()

function execFG(options): Promise<SpawnResultNoStdio>

Execute an arbitrary command in the foreground

Parameters

options: ExecOptions

Returns

Promise<SpawnResultNoStdio>

Defined in

index.ts:331


isRunResult()

function isRunResult(v): v is RunResult

Parameters

v: unknown

Returns

v is RunResult

Defined in

index.ts:166


run()

function run(options): Promise<RunResult>

Run a package.json#scripts event in the background

Parameters

options: RunOptions

Returns

Promise<RunResult>

Defined in

index.ts:144


runExec()

function runExec(
options,
): Promise<SpawnResultStdioStrings | RunResult>

If the arg0 is a defined package.json script, then run(), otherwise exec()

Parameters

options: RunExecOptions

Returns

Promise<SpawnResultStdioStrings | RunResult>

Defined in

index.ts:394


runExecFG()

function runExecFG(options): Promise<SpawnResultNoStdio | RunFGResult>

If the arg0 is a defined package.json script, then runFG(), otherwise execFG()

Parameters

options: RunExecOptions

Returns

Promise<SpawnResultNoStdio | RunFGResult>

Defined in

index.ts:403


runFG()

function runFG(options): Promise<RunFGResult>

Run a package.json#scripts event in the foreground

Parameters

options: RunOptions

Returns

Promise<RunFGResult>

Defined in

index.ts:150