diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-01-28 08:37:32 +0300 |
---|---|---|
committer | nlf <quitlahok@gmail.com> | 2021-01-28 23:39:54 +0300 |
commit | 52e8a1aef4aab3f378c20276a9109bb3f00eccd5 (patch) | |
tree | 88834ae82f44680e68279705719bfe96825cbc2c /docs | |
parent | 7772d9f9f9f853573a7ff8e7fb60c5e46566f596 (diff) |
docs: refreshed npm updated docs
PR-URL: https://github.com/npm/cli/pull/2558
Credit: @ruyadorno
Close: #2558
Reviewed-by: @wraithgar
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/commands/npm-update.md | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/docs/content/commands/npm-update.md b/docs/content/commands/npm-update.md index 424d68618..012c8472c 100644 --- a/docs/content/commands/npm-update.md +++ b/docs/content/commands/npm-update.md @@ -1,7 +1,7 @@ --- title: npm-update section: 1 -description: Update a package +description: Update packages --- ### Synopsis @@ -27,22 +27,11 @@ packages. If no package name is specified, all packages in the specified location (global or local) will be updated. -As of `npm@2.6.1`, the `npm update` will only inspect top-level packages. -Prior versions of `npm` would also recursively inspect all dependencies. -To get the old behavior, use `npm --depth 9999 update`. - -As of `npm@5.0.0`, the `npm update` will change `package.json` to save the -new version as the minimum required dependency. To get the old behavior, -use `npm update --no-save`. - ### Example -IMPORTANT VERSION NOTE: these examples assume `npm@2.6.1` or later. For -older versions of `npm`, you must specify `--depth 0` to get the behavior -described below. - For the examples below, assume that the current package is `app` and it depends -on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` are: +on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` +are: ```json { @@ -84,10 +73,10 @@ However, if `app`'s `package.json` contains: } ``` -In this case, running `npm update` will install `dep1@1.1.2`. Even though the `latest` -tag points to `1.2.2`, this version does not satisfy `~1.1.1`, which is equivalent -to `>=1.1.1 <1.2.0`. So the highest-sorting version that satisfies `~1.1.1` is used, -which is `1.1.2`. +In this case, running `npm update` will install `dep1@1.1.2`. Even though the +`latest` tag points to `1.2.2`, this version do not satisfy `~1.1.1`, which is +equivalent to `>=1.1.1 <1.2.0`. So the highest-sorting version that satisfies +`~1.1.1` is used, which is `1.1.2`. #### Caret Dependencies below 1.0.0 @@ -120,7 +109,9 @@ version that satisfies `^0.4.0` (`>= 0.4.0 <0.5.0`) package that is `outdated` -- that is, has a version that is different from `wanted`. -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>...]` +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>...]` NOTE: If a package has been upgraded to a version newer than `latest`, it will be _downgraded_. |