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.
Npm.Ci
Run 'npm ci' for clean, reproducible installs (preferred for CI). Automatically installs Node.js if not present.
Npm.Run
Run an npm script from package.json. Automatically installs Node.js if not present.
Npm.Test
Run 'npm test'. Automatically installs Node.js if not present.
Npm.Build
Run 'npm run build'. Automatically installs Node.js if not present.

Operation Details

Npm.Install source

Run 'npm install' to install dependencies. Automatically installs Node.js if not present.

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.

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

Npm.Run source

Run an npm script from package.json. Automatically installs Node.js if not present.

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.

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

Npm.Build source

Run 'npm run build'. Automatically installs Node.js if not present.

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);