Skip to content

Commit 52e8a1a

Browse files
ruyadornonlf
authored andcommitted
docs: refreshed npm updated docs
PR-URL: #2558 Credit: @ruyadorno Close: #2558 Reviewed-by: @wraithgar
1 parent 7772d9f commit 52e8a1a

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

docs/content/commands/npm-update.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: npm-update
33
section: 1
4-
description: Update a package
4+
description: Update packages
55
---
66

77
### Synopsis
@@ -27,22 +27,11 @@ packages.
2727
If no package name is specified, all packages in the specified location (global
2828
or local) will be updated.
2929

30-
As of `[email protected]`, the `npm update` will only inspect top-level packages.
31-
Prior versions of `npm` would also recursively inspect all dependencies.
32-
To get the old behavior, use `npm --depth 9999 update`.
33-
34-
As of `[email protected]`, the `npm update` will change `package.json` to save the
35-
new version as the minimum required dependency. To get the old behavior,
36-
use `npm update --no-save`.
37-
3830
### Example
3931

40-
IMPORTANT VERSION NOTE: these examples assume `[email protected]` or later. For
41-
older versions of `npm`, you must specify `--depth 0` to get the behavior
42-
described below.
43-
4432
For the examples below, assume that the current package is `app` and it depends
45-
on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` are:
33+
on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1`
34+
are:
4635

4736
```json
4837
{
@@ -84,10 +73,10 @@ However, if `app`'s `package.json` contains:
8473
}
8574
```
8675

87-
In this case, running `npm update` will install `[email protected]`. Even though the `latest`
88-
tag points to `1.2.2`, this version does not satisfy `~1.1.1`, which is equivalent
89-
to `>=1.1.1 <1.2.0`. So the highest-sorting version that satisfies `~1.1.1` is used,
90-
which is `1.1.2`.
76+
In this case, running `npm update` will install `[email protected]`. Even though the
77+
`latest` tag points to `1.2.2`, this version do not satisfy `~1.1.1`, which is
78+
equivalent to `>=1.1.1 <1.2.0`. So the highest-sorting version that satisfies
79+
`~1.1.1` is used, which is `1.1.2`.
9180

9281
#### Caret Dependencies below 1.0.0
9382

@@ -120,7 +109,9 @@ version that satisfies `^0.4.0` (`>= 0.4.0 <0.5.0`)
120109
package that is `outdated` -- that is, has a version that is different from
121110
`wanted`.
122111

123-
Note: Globally installed packages are treated as if they are installed with a caret semver range specified. So if you require to update to `latest` you may need to run `npm install -g [<pkg>...]`
112+
Note: Globally installed packages are treated as if they are installed with a
113+
caret semver range specified. So if you require to update to `latest` you may
114+
need to run `npm install -g [<pkg>...]`
124115

125116
NOTE: If a package has been upgraded to a version newer than `latest`, it will
126117
be _downgraded_.

0 commit comments

Comments
 (0)