Npm

Run npm commands for JavaScript/TypeScript projects.

Operations

Operation Description
Npm.Install
Run 'npm install' to install dependencies. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.
Npm.Ci
Run 'npm ci' for clean, reproducible installs (preferred for CI). Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.
Npm.Run
Run an npm script from package.json. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.
Npm.Test
Run 'npm test'. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.
Npm.Build
Run 'npm run build'. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

Operation Details

Npm.Install source

Run 'npm install' to install dependencies. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

var frontend = Directory("./frontend");
Npm.Install(frontend);

Npm.Ci source

Run 'npm ci' for clean, reproducible installs (preferred for CI). Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

var frontend = Directory("./frontend");
Npm.Ci(frontend);

Npm.Run source

Run an npm script from package.json. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

var frontend = Directory("./frontend");
Npm.Run(frontend, "build");
Npm.Run(frontend, "lint");

Npm.Test source

Run 'npm test'. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

var frontend = Directory("./frontend");
Npm.Test(frontend);

Npm.Build source

Run 'npm run build'. Automatically installs Node.js if not present. Uses the standard 5-minute command timeout.

var frontend = Directory("./frontend");
Npm.Build(frontend);

Example

Build a frontend application.

// Create a directory reference
var frontend = Directory("./frontend");

// Install dependencies (prefer ci for reproducible builds)
Npm.Ci(frontend);

// Run linting
Npm.Run(frontend, "lint");

// Run tests
Npm.Test(frontend);

// Build for production
Npm.Build(frontend);

Timeouts

Npm operations use ANDO’s standard command timeout. Each Npm.Install, Npm.Ci, Npm.Run, Npm.Test, and Npm.Build command has 5 minutes to finish. If the command exceeds that limit, ANDO stops the process tree and the failed step log reports the timeout, for example Command timed out after 300000ms.

When the same script runs on the ANDO CI Server, the server also applies a whole-build timeout. The default is 15 minutes and the maximum is 60 minutes, configurable through project settings and server Build__DefaultTimeoutMinutes / Build__MaxTimeoutMinutes settings. A single npm command can hit the 5-minute command timeout before the overall build timeout is reached.