Node.js setup - package.json

A package.json is a description file for a Node.js project. It consists of metadata information such as nameauthor, and description, but it also contains a script property that will allow us to run scripts that carry out work for us, such as:

  • Creating a bundle
  • Running tests
  • Performing linting

 To run one of the commands in the script tag, you need to type:

npm run <command>

Your app will depend on a number of libraries to build and run. Libraries listed in either dependencies or devDependencies will be downloaded using npm, by you typing npm install.

There is a semantic difference between what libraries should be listed in dependencies and devDependenciesrespectively. Anything that will help make the app ultimately run will end up in dependencies, Angular libraries, as well as supporting libraries, will end up here. devDependencies is somewhat different, though; what you put here is more of a supportive nature. Examples are TypeScript, Linter, testing libraries, and different tools used to process CSS and create the bundle itself.

As for the angular bits in the dependencies, these are pure Angular dependencies denoted with @angular:

  • @angular/common
  • @angular/compiler
  • @angular/core
  • @angular/forms
  • @angular/http
  • @angular/platform-browser
  • @angular/platform-browser-dynamic
  • @angular/router

The remaining dependencies are the following list, which we mentioned under Core files - that Angular is dependent on in this section:

  • core-js
  • reflect-metadata.js
  • rxjs
  • system.js
  • zone.js
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset