NPM 7.0 package manager available

Published package manager release NPM7.0, included with the Node.js distribution and used to distribute JavaScript modules. The NPM repository maintains over 1.3 million packages, which are used by about 12 million developers. About 75 billion downloads are recorded per month. NPM 7.0 was the first major release formed after purchases NPM Inc by GitHub. The new version will be included in the delivery of a future release of the platform Node.js 15, which is expected on October 20. To install NPM 7.0 without waiting for a new version of Node.js, you can run "npm i -g npm@7".

Key innovations:

  • Workspaces (Workspaces) that allow you to aggregate dependencies from several packages into one package for installation in one step.
  • Automatic installation peer dependencies (used in plugins to determine the base packages that the current package is designed to work with, even if it is not directly used in it). Peer dependencies are specified in the package.json file in the "peerDependencies" section. Previously, these dependencies were manually installed by developers, but NPM 7.0 introduces an algorithm to ensure that a correctly defined peer dependency is found at or above the dependent package in the node_modules tree.
  • The second version of the lock format (package-lock v2) and support for the yarn.lock lock file. The new format allows for repeatable builds and includes everything needed to build a complete package tree. NPM can also now use yarn.lock files as a source of package metadata and lock information.
  • Significant refactoring of internal components has been carried out, aimed at decoupling functionality for easier maintenance and increased reliability. For example, the code for inspecting and managing the node_modules tree has been moved to a separate module arborist.
  • Switched to using the package.exports field, which makes it impossible to include internal modules via the require() call.
  • Completely rewritten package npx, which now uses the "npm exec" command to run executables from packages.
  • Significantly changed the output of the "npm audit" command, both when outputting in a readable format, and when choosing the "--json" mode.

Source: opennet.ru

Add a comment