Npm has announced that npm v7.0.0 will ship with the Node.js 15.0.0 release next week.
Npm v7.0.0 introduces a number of highly requested features, such as Workspaces, the ability to automatically install peer dependencies, and package-lock v2 and support for yarn.lock
Workspaces are a set of features that offer support from managing multiple packages within a single top-level package.
This release also aims to make it easy to automatically install peer dependencies, whereas before developers would need to manually manage and install such dependencies. There is a new peer dependency algorithm that ensures a validly matching peer dependency is found at or above the peer-dependent’s location in the node_modules tree, the npm team explained.
Npm v7.0.0 also adds a new package-lock format that will enable developers to do deterministically reproducible builds. The CLI can now also use yarn.lock as a source of package metadata and resolution guidance.
In addition to those new features, the internals of npm have also been significantly refactored to ensure that the code base is more reliable over time and easier to maintain. “With fewer bugs and a faster iteration cycle we will be able to deliver updates to npm faster than ever before,” npm wrote in a post.
There are a number of breaking changes in this release that developers should be aware of. The ability to automatically install peer dependencies might break certain workflows, require() can no longer use, npx has been completely rewritten, and the output of npm audit has changed in both the human-readable and –json outputs.