name
应用程序/软件包的名称
"name": "nodejs_cn"
名称必须少于 214 个字符,且不能包含空格,只能包含小写字母、连字符(-)或下划线(_)。
files
指定打包后发布到npm的文件,没指定则不传,package.json是默认上传的.
如果希望打包之后上传到npm仓库的代码中包含源文件,则需要在此配置
"files": [
"dist",
"src/components"
],
author
列出软件包的作者名称。
{
"author": "NodeJS中文网 <mail@nodejs.cn> (http://nodejs.cn)"
}
{
"author": {
"name": "NodeJS中文网",
"email": "mail@nodejs.cn",
"url": "http://nodejs.cn"
}
}
contributors
除作者外,该项目可以有一个或多个贡献者。 此属性是列出他们的数组。
{
"contributors": ["NodeJS中文网 <mail@nodejs.cn> (http://nodejs.cn))"]
}
{
"contributors": [
{
"name": "NodeJS中文网",
"email": "mail@nodejs.cn",
"url": "http://nodejs.cn"
}
]
}
bugs
链接到软件包的问题跟踪器,最常用的是 GitHub 的 issues 页面。
{
"bugs": "https://github.com/nodejscn/node-api-cn/issues"
}
homepage
设置软件包的主页。
{
"homepage": "http://nodejs.cn"
}
version
表明了当前的版本
此属性遵循版本的语义版本控制记法,这意味着版本始终以 3 个数字表示:x.x.x。
第一个数字是主版本号,第二个数字是次版本号,第三个数字是补丁版本号。
这些数字中的含义是:仅修复缺陷的版本是补丁版本,引入向后兼容的更改的版本是次版本,具有重大更改的是主版本。
"version": "1.0.0"
license
指定软件包的许可证。
"license": "MIT"
keywords
此属性包含与软件包功能相关的关键字数组。
"keywords": [
"email",
"machine learning",
"ai"
]
description
应用程序/软件包的简短描述
main
应用程序的入口点
"main": "src/main.js"
private
如果设置为 true,则可以防止应用程序/软件包被意外地发布到 npm, 如果要发布到npm, 则需要设置为false
scripts
定义了一组可以运行的 node 脚本
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "jest --config test/unit/jest.conf.js --coverage",
"test": "npm run unit",
"lint": "eslint --ext .js,.vue src test/unit",
"build": "node build/build.js"
}
dependencies
设置了作为依赖安装的 npm 软件包的列表
devDependencies
设置了作为开发依赖安装的 npm 软件包的列表
设置作为开发依赖安装的 npm 软件包的列表。
它们不同于 dependencies,因为它们只需安装在开发机器上,而无需在生产环境中运行代码。
engines
设置了此软件包/应用程序在哪个版本的 Node.js 上运行
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0",
"yarn": "^0.13.0"
}
browserslist
用于告知要支持哪些浏览器(及其版本)。 Babel、Autoprefixer 和其他工具会用到它,以将所需的 polyfill 和 fallback 添加到目标浏览器。
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
此配置意味着需要支持使用率超过 1%(来自 CanIUse.com 的统计信息)的所有浏览器的最新的 2 个主版本,但不含 IE8 及更低的版本。
repository
"repository": {
"type": "git",
"url": "https://github.com/nodejscn/node-api-cn.git"
}
网友评论