liveBook · Manning

Package

As explained in Pro Angular 16

A package is a distributable software unit containing code and metadata that can be installed as a dependency.

A package is a reusable software unit installed into a project. Angular applications depend on many packages, whose dependencies are resolved by a package manager and installed in node_modules. section 9.2.2

The project’s package.json records direct packages in dependencies and devDependencies. Runtime dependencies support the application; development dependencies support building, testing, or other development tasks without belonging to the finished application. section 9.2.2

Manage packages with npm commands:

  • Install the versions declared in package.json with npm install. section 9.2.2
  • Add a specific runtime package with npm install package@version; add a development-only package with --save-dev. section 9.2.2
  • Inspect the local package hierarchy with npm list and run project scripts with npm run. section 9.2.2
  • Choose version constraints deliberately: an exact version locks one release, while prefixes such as ^ or ~ allow defined update ranges. section 9.2.2

Adding a package and wiring its assets

Adding Bootstrap uses npm install bootstrap@5.2.3. Because Bootstrap does not use Angular schematics, its stylesheet must also be added manually to the build styles configuration, such as with ng config. section 20.1.1

cd SportsStore
npm install bootstrap@5.2.3
npm install @fortawesome/fontawesome-free@6.2.1
npm install --save-dev json-server@0.17.3
npm install --save-dev jsonwebtoken@8.5.1

Use this command sequence to install runtime and development packages, including Bootstrap, Font Awesome, json-server, and jsonwebtoken. section 5.1.1

How Pro Angular 16 covers it

How deep it goes
Explains recursive dependency installation, package.json categories, version ranges, npm commands, and manual asset configuration.
Examples
Uses Bootstrap, Font Awesome, Angular Material, Angular PWA, json-server, and jsonwebtoken installation examples.
What it assumes
Assumes an Angular project and npm workflow, while explaining package metadata, dependency resolution, and installation from first principles.
What you can do after
Operate/configure packages with npm, record dependency types, select versions, inspect installations, and include package assets in builds.
How it connects
Connects packages with npm, package managers, package.json, dependencies, devDependencies, node_modules, and Angular configuration.

Also explained in

Compare how 8 books explain package →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.