This repository is a Node.js utility to replace the version ranges in the package.json
file with exact version numbers of each package from the package-lock.json
file. This helps with migration into the save-exact
way of storing packages in the package.json
files.
This project only works for npm
- the default package manager for Node.js projects. Other package managers - like yarn
, pnpm
, bun
, etc. are not supported yet.
To use:
- Clone this repository.
- Switch to Node.js as mentioned in the
.nvmrc
file.- This Node.js version is necessary to run the current repository.
- However, the project can parse
package.json
andpackage-lock.json
files generated bynpm
versions6
through10
(and maybe higher versions not released yet).
- Copy the following files from your Node.js projects into the
input
folder:package.json
package-lock.json
- Note: The files in the
input
folder have been ignored from git. So unless you remove the git configuration, you can't accidentally commit these files into this project.
- Run
npm start
at the root of the project. - If everything goes as expected, a
package.output.json
file should have been generated in theoutput
folder.- You should be able to safely copy the contents from this file into the
package.json
file of your project.
- You should be able to safely copy the contents from this file into the