NPM 7.0 arrives with automatic installation of dependencies and more

Recently the release of the new version of the package manager NPM7.0, included in the Node.js distribution and used to distribute JavaScript modules.

This new version of NPM 7.0 arrives with Workspaces(a set of npm CLI features), which provides support for managing multiple packages, depending on multiple packages to install in one step.

Happy launch on Tuesday! Today marks an important milestone for the npm CLI team - we have officially cut npm@7.0.0. If you've been following this last year, or longer, now that we've been working hard to bring you this version.

The automatic installation of dependencies Peer-to-peer (used in plugins to determine the base packages the current package is designed to work for, even if it is not used directly in it).

Proper peer dependencies for packages are now automatically found, as previously developers had to install them manually.

Peer dependencies are specified in the package.json file in the "peerDependencies" section. NPM 7.0 implements an algorithm to ensure that a properly defined peer dependency is found at or above the dependent package level in the node_modules tree.

Our focus and determination surpassed the last 3 months as we picked up a weekly release cadence and started addressing bugs / comments during our beta / rc windows.

As I mentioned before, we still have a lot of room for improvement, but we think the cli is in a very stable place today and is ready for use. npm v7 will ship with Node.js v15 (a PR to land this work will open shortly) and we look forward to continuing the pace of change / improvement as we approach this final quarter of the year.

Moreover the second version of the lock format is presented (package-lock v2) and support for the yarn.lock lock file.

The packet blocking format has been revised to now apparently contain everything that npm needs to fully build the packet tree. So far yarn.lock files have apparently been ignored, since V7 the npm client can also read package metadata and resolution information from them.

The new format allows repeatable builds and includes everything you need to build a complete package tree.

Additionally, it is mentioned that despite the massive overhaul of npm internals, the team has worked tirelessly to ensure that there are minimal disruptions to most workflows.

A major internal component refactoring, with the aim of separating functionality to simplify maintenance and increase reliability.

For example, the code to inspect and manage the node_modules tree has been moved to a separate Arborist module.

Transitioned to using package.exports field, which makes it impossible to connect internal modules via require () call.
Completely rewritten npx package, which now uses the "npm exec" command to run executables from packages.

The output of the "npm audit" command has changed significantly, both when generated in human-readable format and when the "–json" mode is selected.

Download

The new version is now available to the general public and you can quickly update the previous version or fully install this new version.

Finally, it is important to know that the NPM repository serves more than 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 significant release formed after the purchase of NPM Inc by GitHub.

The new version will ship with a future version of the Node.js 15 platform, scheduled for October 20. To install NPM 7.0 without waiting for a new version of Node.js, it can be done by running the command in your terminal:

npm i -g npm@7

If you want to know more about it About the new version released, you can check the details in the official announcement.

The link is this.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.