File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
cheatsheets/javascript/npm Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title : Upgrade old versions
3+ description : Guide to managing out NPM packages in your project
4+ ---
5+
6+ ## Find outdated packages
7+
8+ [ docs] ( https://docs.npmjs.com/cli/outdated )
9+
10+ > This command will check the registry to see if any (or, specific) installed packages are currently outdated.
11+
12+ ``` sh
13+ $ npm outdated
14+ ```
15+
16+ ## Upgrade packages
17+
18+ [ docs] ( https://docs.npmjs.com/cli/update )
19+
20+ > This command will update all the packages listed to the latest version (specified by the tag config), respecting semver.
21+
22+ ``` sh
23+ $ npm update
24+ ```
25+
26+ This can be used with ` -g ` flag too.
27+
28+ Optionally supply package names as arguments.
29+
30+ Note that the above command will still stick with your bounds of tilde and caret.
31+
32+
33+ ### Newest
34+
35+ If you want to install the absolute latest available, you a separate tool.
36+
37+ [ docs] ( https://www.npmjs.com/package/npm-upgrade )
38+
39+ > Interactive CLI utility to easily update outdated NPM dependencies with changelogs inspection support.
40+
41+ ``` sh
42+ $ npx npm-upgrade
43+ ```
44+
45+ ## Fix security sulnernabities
46+
47+ ### Audit
48+
49+ ``` sh
50+ $ npm audit
51+ ```
52+
53+ ### Fix
54+
55+ ``` sh
56+ $ npm audit --fix
57+ ```
You can’t perform that action at this time.
0 commit comments