liveBook · Manning

Npm script

An npm script is a named command declared in a project's package.json file and runnable through npm.

How 4 Manning books explain it

Web Components in Action

npm scripts are named commands declared in package.json and executed through npm to automate project tasks.

How it is used
Automates project tasks and shortens repeatable build commands through package.json.
How deep it goes
Defines scripts, demonstrates npm run execution, and chains component builds, but stops short of general orchestration theory.
Examples
Uses echo, local Rollup commands, component-specific build scripts, and an aggregate script joined with &&.
What you can do after
Operate/configure named npm commands for individual component bundles and complete multi-component builds.

Read how Web Components in Action explains npm script →

Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

An npm script is a named command configuration in a project's package.json file that can be invoked through npm.

How it is used
Provides memorable project commands for starting microservices and running tests without exposing entry points or testing-tool details.
How deep it goes
Shows package.json entries and invocation commands for production, development, and testing, without examining npm’s execution internals.
Examples
Uses `npm start`, `npm run start:dev`, `npm test`, and `npm run test:watch` with matching package.json entries.
What you can do after
Operate/configure it by adding named package.json commands and invoking standard or custom scripts through npm.

Read how Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform explains npm script →

Pro Angular 16

The scripts section is the package.json field containing named command definitions that a package manager can execute.

How it is used
Runs project-local development, build, watch, testing, and supporting commands through package.json.
How deep it goes
Defines command mappings and execution syntax, but does not detail npm’s script resolution internals.
Examples
Uses start, build, watch, test, and json scripts, including a json-server command serving restData.js on port 3500.
What you can do after
Operate/configure project tools through named npm commands executed from the package.json directory.

Read how Pro Angular 16 explains npm script →

Essential TypeScript 5, Third Edition

The scripts section is the package.json configuration section that defines named commands runnable through npm.

How it is used
Centralizes repeatable compiler, server, bundler, build, test, and lint commands behind short npm invocations.
How deep it goes
Defines scripts through complete package.json examples and shows parallel execution, but does not detail npm script resolution internals.
Examples
Demonstrates tsc-watch, node dist/index.js, json-server, webpack serve, Angular CLI, and React scripts in package.json.
What you can do after
Operate development workflows with npm start and configure scripts that launch tools separately or in parallel.

Read how Essential TypeScript 5, Third Edition explains npm script →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.