@

必须的属性

name

  • 全部小写
  • 一个单词,没有空格
  • 可以使用下划线和破折号

版本号

*形式:x.x.x

  {"name": "my-awesome-package",
  "version": "1.0.0"
  }

非必须的属性

scripts

  • 是一个对象,对象内部是项目的生命周期各个环节需要执行的命令,key是生命周期中的事件,value是要执行的命令,详见https://docs.npmjs.com/misc/scripts

dependencies

  • 生产中应用所需要的依赖
  • 包含版本名称和版本范围

devdependendies

  • 开发和测试所需要的依赖

config对象

  • 将不怎么变动的配置写在config里面,如:
"config" : { "port" : "8080" }

engines

  • 指定node版本范围
{ "engines" : { "node" : ">=0.10.3 <0.12" } }
  • 指定npm版本
{ "engines" : { "npm" : "~1.0.20" } }
 posted on 2020-09-06 11:32  en、  阅读(96)  评论(0)    收藏  举报