6g下载网
当前位置: 主页 > 软件教程 > 编程开发 >

package.json文件介绍

时间: 2017-05-19 23:03 来源: 6g下载网

分享到:

package.json 位于模块的目录下,用于定义包的属性。接下来让我们来看下 express 包的 package.json 文件,位于 node_modules/express/package.json 内容:

  1. {  
  2.   "name": "express",  
  3.   "description": "Fast, unopinionated, minimalist web framework",  
  4.   "version": "4.13.3",  
  5.   "author": {  
  6.     "name": "TJ Holowaychuk",  
  7.     "email": "tj@vision-media.ca"  
  8.   },  
  9.   "contributors": [  
  10.     {  
  11.       "name": "Aaron Heckmann",  
  12.       "email": "aaron.heckmann+github@gmail.com"  
  13.     },  
  14.     {  
  15.       "name": "Ciaran Jessup",  
  16.       "email": "ciaranj@gmail.com"  
  17.     },  
  18.     {  
  19.       "name": "Douglas Christopher Wilson",  
  20.       "email": "doug@somethingdoug.com"  
  21.     },  
  22.     {  
  23.       "name": "Guillermo Rauch",  
  24.       "email": "rauchg@gmail.com"  
  25.     },  
  26.     {  
  27.       "name": "Jonathan Ong",  
  28.       "email": "me@jongleberry.com"  
  29.     },  
  30.     {  
  31.       "name": "Roman Shtylman",  
  32.       "email": "shtylman+expressjs@gmail.com"  
  33.     },  
  34.     {  
  35.       "name": "Young Jae Sim",  
  36.       "email": "hanul@hanul.me"  
  37.     }  
  38.   ],  
  39.   "license": "MIT",  
  40.   "repository": {  
  41.     "type": "git",  
  42.     "url": "git+https://github.com/strongloop/express.git"  
  43.   },  
  44.   "homepage": "http://expressjs.com/",  
  45.   "keywords": [  
  46.     "express",  
  47.     "framework",  
  48.     "sinatra",  
  49.     "web",  
  50.     "rest",  
  51.     "restful",  
  52.     "router",  
  53.     "app",  
  54.     "api"  
  55.   ],  
  56.   "dependencies": {  
  57.     "accepts": "~1.2.12",  
  58.     "array-flatten": "1.1.1",  
  59.     "content-disposition": "0.5.0",  
  60.     "content-type": "~1.0.1",  
  61.     "cookie": "0.1.3",  
  62.     "cookie-signature": "1.0.6",  
  63.     "debug": "~2.2.0",  
  64.     "depd": "~1.0.1",  
  65.     "escape-html": "1.0.2",  
  66.     "etag": "~1.7.0",  
  67.     "finalhandler": "0.4.0",  
  68.     "fresh": "0.3.0",  
  69.     "merge-descriptors": "1.0.0",  
  70.     "methods": "~1.1.1",  
  71.     "on-finished": "~2.3.0",  
  72.     "parseurl": "~1.3.0",  
  73.     "path-to-regexp": "0.1.7",  
  74.     "proxy-addr": "~1.0.8",  
  75.     "qs": "4.0.0",  
  76.     "range-parser": "~1.0.2",  
  77.     "send": "0.13.0",  
  78.     "serve-static": "~1.10.0",  
  79.     "type-is": "~1.6.6",  
  80.     "utils-merge": "1.0.0",  
  81.     "vary": "~1.0.1"  
  82.   },  
  83.   "devDependencies": {  
  84.     "after": "0.8.1",  
  85.     "ejs": "2.3.3",  
  86.     "istanbul": "0.3.17",  
  87.     "marked": "0.3.5",  
  88.     "mocha": "2.2.5",  
  89.     "should": "7.0.2",  
  90.     "supertest": "1.0.1",  
  91.     "body-parser": "~1.13.3",  
  92.     "connect-redis": "~2.4.1",  
  93.     "cookie-parser": "~1.3.5",  
  94.     "cookie-session": "~1.2.0",  
  95.     "express-session": "~1.11.3",  
  96.     "jade": "~1.11.0",  
  97.     "method-override": "~2.3.5",  
  98.     "morgan": "~1.6.1",  
  99.     "multiparty": "~4.1.2",  
  100.     "vhost": "~3.0.1"  
  101.   },  
  102.   "engines": {  
  103.     "node": ">= 0.10.0"  
  104.   },  
  105.   "files": [  
  106.     "LICENSE",  
  107.     "History.md",  
  108.     "Readme.md",  
  109.     "index.js",  
  110.     "lib/"  
  111.   ],  
  112.   "scripts": {  
  113.     "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/ test/acceptance/",  
  114.     "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/ test/acceptance/",  
  115.     "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/ test/acceptance/",  
  116.     "test-tap": "mocha --require test/support/env --reporter tap --check-leaks test/ test/acceptance/"  
  117.   },  
  118.   "gitHead": "ef7ad681b245fba023843ce94f6bcb8e275bbb8e",  
  119.   "bugs": {  
  120.     "url": "https://github.com/strongloop/express/issues"  
  121.   },  
  122.   "_id": "express@4.13.3",  
  123.   "_shasum": "ddb2f1fb4502bf33598d2b032b037960ca6c80a3",  
  124.   "_from": "express@*",  
  125.   "_npmVersion": "1.4.28",  
  126.   "_npmUser": {  
  127.     "name": "dougwilson",  
  128.     "email": "doug@somethingdoug.com"  
  129.   },  
  130.   "maintainers": [  
  131.     {  
  132.       "name": "tjholowaychuk",  
  133.       "email": "tj@vision-media.ca"  
  134.     },  
  135.     {  
  136.       "name": "jongleberry",  
  137.       "email": "jonathanrichardong@gmail.com"  
  138.     },  
  139.     {  
  140.       "name": "dougwilson",  
  141.       "email": "doug@somethingdoug.com"  
  142.     },  
  143.     {  
  144.       "name": "rfeng",  
  145.       "email": "enjoyjava@gmail.com"  
  146.     },  
  147.     {  
  148.       "name": "aredridel",  
  149.       "email": "aredridel@dinhe.net"  
  150.     },  
  151.     {  
  152.       "name": "strongloop",  
  153.       "email": "callback@strongloop.com"  
  154.     },  
  155.     {  
  156.       "name": "defunctzombie",  
  157.       "email": "shtylman@gmail.com"  
  158.     }  
  159.   ],  
  160.   "dist": {  
  161.     "shasum": "ddb2f1fb4502bf33598d2b032b037960ca6c80a3",  
  162.     "tarball": "http://registry.npmjs.org/express/-/express-4.13.3.tgz"  
  163.   },  
  164.   "directories": {},  
  165.   "_resolved": "https://registry.npmjs.org/express/-/express-4.13.3.tgz",  
  166.   "readme": "ERROR: No README data found!"  

Package.json 属性说明:

name - 包名。

version - 包的版本号。

description - 包的描述。

homepage - 包的官网 url 。

author - 包的作者姓名。

contributors - 包的其他贡献者姓名。

dependencies - 依赖包列表。如果依赖包没有安装,npm 会自动将依赖包安装在 node_module 目录下。

repository - 包代码存放的地方的类型,可以是 git 或 svn,git 可在 Github 上。

main - main 字段是一个模块ID,它是一个指向你程序的主要项目。就是说,如果你包的名字叫 express,然后用户安装它,然后require("express")。

keywords - 关键字

(责任编辑:大卫)
标签:npm json package

分享到:

------分隔线----------------------------