- {
- "name": "test",
- //项目名称(必须),由小写英文字母、数字和下划线,不能含空格
- "version": "1.0.0",
- //项目版本(必须)
- "description": "This is for study gulp project !",
- //项目描述(必须)
- "homepage": "",
- //项目主页url
- " keysords": [ //一个字符串数组,方便别人搜索到本模块
- "package", "example"],
- "maintainers": [{ //维护者数组,每个元素要包含 name、 email (可选)、 web (可选)字段。
- "name": "Bill Smith",
- "email": "bills@example.com",
- }],
- "contributors": [{ //贡献者数组,格式与maintainers相同。包的作者应该是贡献者数组的第一个元素。
- "name": "BYVoid",
- "web": "http://www.byvoid.com/"
- }],
- "bugs": { //提交bug的地址,可以是网址或者电子邮件地址。
- "mail": "dev@example.com",
- "web": "http://www.example.com/bugs"
- },
- "repository": { //项目资源库
- "type": "git",
- "url": "https://git.oschina.net/xxxx"
- },
- "author": { //项目作者信息
- "name": "surging",
- "email": "surging2@qq.com"
- },
- "license": "ISC",
- //项目许可协议
- "devDependencies": { //项目依赖的插件
- "gulp": "^3.8.11",
- "gulp-less": "^3.0.0"
- },
- "main": "",
- //main属性指定了程序的主入口文件。意思是,如果你的模块被命名为foo,用户安装了这个模块并通过require("foo")来使用这个模块,那么require返回的内容就是main属性指定的文件中 module.exports指向的对象。
- "bin": { //多模块有一个或多个需要配置到PATH路径下的可执行模块,npm让这个工作变得十分简单
- "my-program": "./path/to/program"
- },
- "scripts": { //cripts属性是一个对象,里边指定了项目的生命周期个各个环节需要执行的命令。key是生命周期中的事件,value是要执行的命令。
- "start": "node server.js" //详见https://docs.npmjs.com/misc/scripts
- },
- "config": {
- "port": "8080"
- },
- //用来设置一些项目不怎么变化的项目配置,用法http.createServer(...).listen(process.env.npm_package_config_port)
- "dependencies": { //包的依赖,一个关联数组,由包名称和版本号组成。
- "co": "^4.6.0",
- "debug": "^2.2.0",
- "swig": "^1.2.2",
- "node-rest-client": "^2.5.0",
- "koa": "^1.1.2",
- "koa-bodyparser": "^2.0.1",
- "koa-json": "^1.1.1",
- "koa-onerror": "^1.2.1",
- "koa-router": "^5.3.0",
- }
- }
来源: http://www.bubuko.com/infodetail-1966035.html