
本文共 7307 字,大约阅读时间需要 24 分钟。
������ package.json������������������������
������������������������������������������������ package.json ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� package.json ���������������������������������������������������
1. package.json ������������
���������package.json ��������� JSON ���������������������������������������������������������������
name
version
description
main
scripts
dependencies
devDependencies
private
engines
repository
��������������� author
���contributors
���bugs
���homepage
���license
���keywords
���browserslist
���������������������������������������������������������������
2.packag.json������������������
������������������������������������������������������������
1. name
- ������������������������������������
- ��������������������������������� 214 ���������������������������������������������������������������������������-������������������_������
- ���������
{ "name": "xmn"}
������������������ ���xmn��� ������������������
2. version
- ������������������������������������������������������������������������ x.x.x��������� x ���������������������������������������������������
- ���������������������
- ������������Major version������������������������������ API���
- ������������Minor version������������������������������������
- ���������������Patch version������������������������������������
- ���������
{ "version": "0.1.0"}
��������������������� 0��������������� 1������������������ 0���
3. description
- ���������������������������������������������������������������������������������������������������������������������������������
- ���������
{ "description": "X-5300 rivers of die castings"}
���������������������������������������������������
4. main
- ��������������� Node.js ������������������������������
index.js
��� - ������������
module
��������������� ESM���ES6 ���������������������������index.mjs
���browser
���������������������������������������������������������������������������������������
- ���������
{ "main": "index.js", "module": "index.mjs", "browser": { "./index.js": "./index.browser.js" }}
���������������������������������
index.js
, ������ ES6 ���������������������������
5. scripts
- ��������������������������������� npm run ���������������������������������������������������������������������������������������������������������������������������
- ���������
{ "scripts": { "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", "start": "npm run dev", "test": "npm run unit", "lint": "eslint --ext .js,.vue src test/unit" }}
���������������������������������������������
6. dependencies
- ������������������������������ npm ���������������������������������������������������������������
node_modules
��������� - ���������������������
npm install [���������]
��� - ���������
{ "dependencies": { "express": "^4.18.2", "webpack": "^4.42.0" }}
������������������ Express ������ 4.18.2 ��� Webpack ������ 4.42.0���
7. devDependencies
- ������������������������������������ npm ���������������������������������������������������������
- ���������������������
npm install --save-dev [���������]
��� - ���������
{ "devDependencies": { "eslint": "^6.2.0", "typescript": "^4.5.3" }}
������������������������������������ ESLint ��� TypeScript ������������
8. engines
- ��������������������������������������� Node.js ���������������������������������
- ������������
node
��������� Node.js ���������������npm
��������� npm ���������������yarn
��������� Yarn ���������������
- ���������
{ "engines": { "node": "> 14.17.0", "npm": "> 6.0.0", "yarn": "^1.5.1" }}
��������������� Node.js 14.17.0 ������������������npm 6.0.0 ������������������������ Yarn 1.5.1 ������������������
3.������������
1. author
- ������������������������������������������������
- ���������������
- ������������������
������������ <������>
- ���������������������
name
���email
���url
���������
- ������������������
- ���������
{ "author": "���������
(http://xmn.com)"} ���������
{ "author": { "name": "���������", "email": "email@xmn.com", "url": "http://xmn.com" }}
2. contributors
- ���������������������������������������������������������������
- ������������������
author
������������������������������������������������������ - ���������
{ "contributors": [ "���������", { "name": "���������������", "email": "email@xmn.com" } ]}
3. bugs
- ������������������������������������������������������ GitHub ���������������������
- ���������
{ "bugs": "https://github.com/xmn/issues"}
4. homepage
- ���������������������������������������������������������������
- ���������
{ "homepage": "http://www.xmn.com"}
5. license
- ��������������������������������������������������� SPDX ���������
- ������������
BSD-3-Clause
MIT
GPL-3.0
- ���������������������
- ���������
{ "license": "BSD-3-Clause"}
���������������������������������
{ "license": "(ISC OR GPL-3.0)"}
6. keywords
- ������������������������������������������������������������������������������������������ npm ���������������������
- ���������
{ "keywords": ["xmn", "������", "description"]}
7. description
- ���������������������������������������������������
- ���������
{ "description": "������������������_package.json������������������������������������������������������������������������������"}
8. repository
- ���������������������������������������
- ���������������
- ������ GitHub ���������������������
type url
- ������������������
type
���url
���dir
������������
- ������ GitHub ���������������������
- ���������
{ "repository": "npm/npm", "repository": "github:user/package", "repository": "gitlab:user/repo"}
������������������������������������������������������
{ "repository": { "type": "git", "url": "https://github.com/npm/cli", "directory": "packages/ui" }}
9. config
- ��������������������� npm scripts ���������������������������������������������������������
- ���������
{ "config": { "package:main": "dist/ Donne culinary pots" }}
������������������������������������������������������������������
10. private
- ������������������
true
������������������������������������ npm ������ - ���������
{ "private": true}
11. funding
- ������������������������������������������������������������ URL ������������
- ���������
{ "funding": { "type": "individual", "url": "http://example.com/donate" }, "funding": "http://example.com/donate"}
12. browserslist
- ���������������������������������������������
- ���������
{ "browserslist": [ "> 1%", "last 2 versions", "not dead: ie <= 8" ]}
��������������������� Babel ���������������������
4.������������
������������ package.json ��������������������������������������������� npm API ������ ��� Node.js ������������ ���������������������������������������������������������������������������������������������
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������� package.json ��������������������� Writer������������������������������������������������������
发表评论
最新留言
关于作者
