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
Standardizes microservice startup and test commands while hiding project-specific command details.
How deep it goes
Defines scripts in package.json and demonstrates invocation and live-reload configurations without examining npm internals.
Examples
Illustrates microservice startup with nodemon and Jest test execution with watch mode.
What you can do after
Apply it via npm to configure and run named startup and test commands.

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 →

Also covered in

What to know first

Related concepts

Questions about npm script

What is npm script?

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

Which Manning books explain npm script?

Web Components in Action, Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform, Pro Angular 16 and Essential TypeScript 5, Third Edition.

What should I know before learning npm script?

Manning books that teach npm script usually introduce package.json, HTTP request, decorator and package first.

What kinds of npm script are there?

Kinds of npm script include npm start command.

What is npm script part of?

Npm script is part of package.json. package.json is the standard JSON manifest for an npm or Node.js package, declaring metadata, dependencies, scripts, entry points, and related configuration.

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.