Learning npm (XI) of the package-lock.json

package-lock.json

description

For any operating node_modules npm modify the tree or package.json generated automatically package.json, which describes the exact tree generated, so that subsequent installation of the same tree can be generated, regardless of how the updated intermediate term dependent .

This document is submitted to the source repository, and for the following purposes:

  • Description single representation dependency tree to ensure teammate, deployment and continuous integration can be mounted exactly the same dependencies.
  • To provide users with a tool that allows them to "pass through" to a previous state node_modules, without having to submit the directory itself.
  • By controlling the difference-readable source code, improving visibility tree changes.
  • And to optimize the installation process skips metadata analysis is repeated by allowing the previously installed package npm.

About a key details of package-lock.json it is that it is not released anywhere except toplevel package if it's found, it will be ignored. It shares with npm-shrinkwrap.json a format that is essentially the same file, but allows publishers. Unless the deployment tool CLI or use the publishing process to generate a production package, it is not advisable to do so.

If the package-lock.json and npm-shrinkwrap.json present in the root directory packet, package-lock.json will be completely ignored.

file format

name (first name)

Package-lock.json name must match the contents of the package in package.json.

version (version)

Package-lock.json name must match the contents of the package in package.json.

lockfileVersion

Version integer starting from 1, the version number of the document 1, using the semantics of the document when generating the package-lock.json.

packageIntegrity

This is a sub-resource integrity value created from the package.json. Ought not to be package.json pretreatment. Sub-resource integrity ssri string may be generated by such a module.

preserveSymlinks

When the installation is complete indication enabled environment variable NODE_PRESERVE_SYMLINKS. The installer should adhere to the value of this property and the environment variable match.

dependencies (dependencies)

Package name to the dependency object mapping. Dependent object has the following properties:

  • version: Version
  • integrity: This is the standard sub-resources integrity of the resources

  • resolved: Source

  • bundled

  • dev

  • optional

  • requires: dependencies

 

Guess you like

Origin www.cnblogs.com/kunmomo/p/11222461.html