+1 vote
in Angular by
Explain package.json file.

1 Answer

0 votes
by

This file contains information about Angular 2 project. Following are the typical settings in the file.

   "name": "angular-quickstart", 

   "version": "1.0.0", 

   "description": "QuickStart package.json from the documentation, 

      supplemented with testing support", 

   

   "scripts": { 

      "build": "tsc -p src/", 

      "build:watch": "tsc -p src/ -w", 

      "build:e2e": "tsc -p e2e/", 

      "serve": "lite-server -c=bs-config.json", 

      "serve:e2e": "lite-server -c=bs-config.e2e.json", 

      "prestart": "npm run build", 

      "start": "concurrently \"npm run build:watch\" \"npm run serve\"", 

      "pree2e": "npm run build:e2e", 

      "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --killothers --success first", 

      "preprotractor": "webdriver-manager update", 

      "protractor": "protractor protractor.config.js", 

      "pretest": "npm run build", 

      "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"", 

      "pretest:once": "npm run build", 

      "test:once": "karma start karma.conf.js --single-run", 

      "lint": "tslint ./src/**/*.ts -t verbose" 

   }, 

  

   "keywords": [], 

   "author": "", 

   "license": "MIT", 

   "dependencies": { 

      "@angular/common": "<2.4.0", 

      "@angular/compiler": "<2.4.0", 

      "@angular/core": "<2.4.0",

      "@angular/forms": "<2.4.0", 

      "@angular/http": "<2.4.0", 

      "@angular/platform-browser": "<2.4.0", 

      "@angular/platform-browser-dynamic": "<2.4.0", 

      "@angular/router": "<3.4.0",  

      "angular-in-memory-web-api": <0.2.4", 

      "systemjs": "0.19.40", 

      "core-js": "^2.4.1", 

      "rxjs": "5.0.1", 

      "zone.js": "^0.7.4" 

   }, 

  

   "devDependencies": { 

      "concurrently": "^3.2.0", 

      "lite-server": "^2.2.2", 

      "typescript": "<2.0.10",  

      "canonical-path": "0.0.2", 

      "tslint": "^3.15.1", 

      "lodash": "^4.16.4", 

      "jasmine-core": "<2.4.1", 

      "karma": "^1.3.0", 

      "karma-chrome-launcher": "^2.0.0", 

      "karma-cli": "^1.0.1", 

      "karma-jasmine": "^1.0.2", 

      "karma-jasmine-html-reporter": "^0.2.2", 

      "protractor": <4.0.14", 

      "rimraf": "^2.5.4",  

      "@types/node": "^6.0.46", 

      "@types/jasmine": "2.5.36" 

   }, 

   "repository": {} 

}

Some key points to note about the above code −

There are two types of dependencies, first is the dependencies and then there are dev dependencies. The dev ones are required during the development process and the others are needed to run the application.

The "build:watch": "tsc -p src/ -w" command is used to compile the typescript in the background by looking for changes in the typescript files.

Related questions

0 votes
asked Nov 24, 2019 in Angular by rajeshsharma
+1 vote
asked Jan 24, 2022 in Angular by sharadyadav1986
...