码迷,mamicode.com
首页 > Web开发 > 详细

关于package.json

时间:2018-05-16 12:49:14      阅读:883      评论:0      收藏:0      [点我收藏+]

标签:smi   dynamic   运行   router   配置   compile   cmd   6.2   htm   

---恢复内容开始---

用angular开发前台项目,每个项目的根目录下面,都有一个package.json文件,

定义了项目所需要的各种模块依赖,和项目的配置信息(比如名称,版本号等信息,有点像maven)。当我们执行npm install 命令时,就会根据这个配置文件,自动下载所需要的模块,也就是配置项目所需要的运行和开发环境。

for example,下面是一个最简单的package.json文件,只定义两项数据:项目名称和版本

{
    “name” : "xxx",
    "version" : "0.0.0", 
}

说明:package.json文件内部就是一个json对象,该对象的每一个成员就是当前项目的一项设置,

name就是项目名称,version是版本(版本写法遵守“大版本.次要版本.小版本”的格式)。

下面是一个完整的package.json文件。

{
  "name": "cmdb-front",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "bootstrap": "^4.0.0-alpha.6",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "d3": "^4.10.0",
    "echarts": "^3.8.5",
    "font-awesome": "^4.7.0",
    "intl": "^1.2.5",
    "jquery": "^3.2.1",
    "ng2-cookies": "^1.0.12",
    "primeng": "^4.2.2",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.2.6",
    "@angular/compiler-cli": "^4.0.0",
    "@angular/language-service": "^4.0.0",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.0.1",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.0.4",
    "tslint": "~5.3.2",
    "typescript": "~2.3.3"
  }
}

下面就具体说明package..json文件中各个字段的意思。

 

 

---恢复内容结束---

关于package.json

标签:smi   dynamic   运行   router   配置   compile   cmd   6.2   htm   

原文地址:https://www.cnblogs.com/javazxy/p/9045028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!