Comments (4)
As a minor note I recall this CLI tool used to be handy: https://www.npmjs.com/package/npm-check-updates
Perhaps it would also be useful to have instructions for other package manager like yarn and pnpm. Also monorepo tools like rush could be good to mention as well.
from node-essentials.
Small comments:
-
npm update <optional package name>
only updates according to the semantic versioning used: ~ allows patch updates, ^ allows minor version updates. For major version updates, usually the way isnpm install <name>@latest
-
npm audit fix --force
does not necessarily updates packages, as it tries to fix security issues sometimes it reverts to an older packages version outside of the allowed semantic versioning specified in package.json.
Otherwise, the rest looks fine to me :)
from node-essentials.
Edited ...
The recommended workflow for updates is:
npm run test
: Verify your existing tests pass before starting this update process.npm audit
: to check for vulnerabilities in the current version you are using. The information fromnpm audit
may recommend updating to a major version. You should carefully review the breaking changes if any are listed.npm outdated
: to list all the outdated packages. This command provides information in the Wanted, Latest, and Location columns.- Update with
npm update
:- For smaller projects (a few dependencies in the
package.json
: you may trynpm update
to update all dependencies then run your tests. - For larger projects (with many dependencies in the
package.json
: update a single package or package family (such as Next.js and React) then run the tests.
- For smaller projects (a few dependencies in the
npm audit
: check there are no critical or high vulnerabilities. If vulnerabilities still exist, usenpm update
with the package name and the major version recommended innpm audit
.npm run test
again.- Check in your
package.json
andpackage-lock.json
.
from node-essentials.
I think the whole content is super good, adding a possible option for people to make it easier to update versions manually: VSCode has an extension called Version Lens, that allows you to see in realtime the current version, the latest version, and the version your package.json
will satisfy.
https://marketplace.visualstudio.com/items?itemName=pflannery.vscode-versionlens
If your objective is to go to the latest version in all the dependencies, then just:
- Open
package.json
- Manually click the inlay hints to update the text to the major versions (like @sinedied commented, major versions are usually updated by installing only)
- Run
npm update
ornpm install
to update the versions to the latest ones
This works nicely when you have multiple packages and when you have big projects because you can actually see which are the most impactful dependencies in the system and manually check for major updates one by one.
from node-essentials.
Related Issues (10)
- Typo in NodeJS course HOT 1
- File System example error HOT 1
- Incorrect path.join in learning material
- Incorrect command "node.index.js" in learning material HOT 1
- **Describe the bug**
- there are too much errors in this repo's codes? HOT 1
- Recommended code for exercise doesn't work HOT 2
- Add exercise 5 to build/test github action HOT 1
- Missing `client-delete-route.js` from repo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-essentials.