package.json understanding

Example 1. Role and

The root of each item below, generally have a package.json file, define the project required various modules, and configuration information items (such as name, version, license and other metadata). npm installAccording to this configuration file command to automatically download the required module, that configuration is required to run the project and development environment.

{
  "name": "firstProj",
  "version": "1.0.1",
  "description": "第一个项目",
  "license": "GPL",
  "author": [
    "xiaotang <[email protected]>"
  ],
  "homepage": "http://www.rumoss.cn",
  "devDependencies": {
    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-concat": "^2.6.0 ",
    "gulp-header": "^1.8.8",
    "gulp-if": "^2.0.1",
    "gulp-minify-css": "^1.2.4",
    "gulp-rename": "^1.2.2",
    "gulp-replace": "^0.6.1",
    "gulp-uglify": "^1.5.4",
    "minimist": "^1.2.0"
  }
}

Detailed 2.package.json

  • name:name
  • version:version number
  • description:description
  • license:license
  • author: Author
  • homepage: Project Home
  • devDependencies: Specifies the dependent package name and its version of the mapping range
    • ^1.2.2: Install the latest version 1.xx of (not less than 1.2.2), but does not install 2.xx
    • ~1.2.2: Install the latest version of 1.2.x (not less than 1.2.2), but does not install 1.3.x

3.package-lock.json role

package-lock.jsonAt npm installthe time a document is automatically generated for each record the current state of the actual installation npm packageof specific sources and version number.

  • The advantage is that the version number of the package can be locked at the time of installation, and need to be uploaded to the warehouse to ensure that other people npm installdepend on the time of installation to ensure consistency

Guess you like

Origin www.cnblogs.com/HeCG95/p/11982480.html