I recently stumbled upon an new feature of Composer added on 06/22 named composer bump
(see this post) which brings a good way to keep track of the updates made to your repository.
As we all know, versionning is essential for the following reasons :
- Ability to rollback to a previous version of your code
- Collaborate and handle merge conflicts
- You can travel back in time to know when a piece of code was modified
Thatโs why "updating" your composer.json
at the same time as running composer update
can be a way to know what happened when something goes wrong later.
In the end we have something clear and tracked in time
What about NPM ?
While doing my chores on a React project i looked for a similar feature with NPM (Node package manager), but surprisingly there is no such thing !
Chat-GPT struggled with my question... A LOT ๐ Npm version is not the right answer.
The savior: NCU
Sometimes, youโre just glad to find a package that makes everything that you need, and even more. The chosen one is Npm check update made by Raine Revere and it allows you to :
- List all new dependencies
- Interactively upgrade them
- Upgrade your package.json
So if you want to have a package.json file up to date with your locked dependencies just install the package globally
npm install -g npm-check-updates
And run ncu -u
to upgrade your package.json
Donโt forget to run npm install
to install the updates and to renegerate your package-lock.json
You'll end up with this nice diff while commiting your dependencies update
Hopefully it was useful to you ๐
Top comments (0)