首页 > 技术文章 > package.json

Hao-Killer 2017-07-31 11:18 原文

纯JSON

  • 项目名:name, string, *
"name": "nicefish"
  • 版本号:version, string, *
"version": "5.12.3"
  • 描述:description, string
"description": "The Metaverse virtual reality. The final outcome of all virtual worlds, augmented reality, and the Internet."
  • 关键字:keywords, Array
"keywords": [
     "metaverse",
     "virtual reality",
     "augmented reality",
     "snow crash"
]
  • 问题追踪系统的URL或邮箱地址: bugs, obj
"bugs": {
    "url": "https://github.com/angular/angular/issues"
}
  • 依赖模块(生产环境中需要的依赖):dependencies, Array

    该模块(项目)运行所依赖的模块

"dependencies": {
     "async": "^0.2.10",
     "npm2es": "~0.4.2",
     "optimist": "~0.6.0",
     "request": "~2.30.0",
     "skateboard": "^1.5.1",
     "split": "^0.3.0",
     "weld": "^0.2.2"
}
  • 开发时需要的模块(不会被部署到生产环境):devDependencies, Array
"devDependencies": {
     "karma": "1.4.0",
     "karma-chrome-launcher": "2.0.0",
     "karma-cli": "1.0.1"
}
  • 用来供插件指定其所需要的主工具的版本:peerDependencies, obj
{
  "name": "chai-as-promised",
  "peerDependencies": {
    "chai": "1.x"
  }
}
  • 指定运行脚本命令的 npm 命令行缩写:scripts, obj
"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
},
  • 指定各个内部命令对应的可执行文件的位置:bin, obj
"bin": {
  "someTool": "./bin/someTool.js"
}
  • 指明该模块运行的平台:engines, obj
"engines" : {
    "node" : ">=0.10.3 <0.12"
}

"engines" : {
    "npm" : "~1.0.20"
}

推荐阅读