From 64f0ae58f4bbaa5e1d937eb327cec011132c4dfa Mon Sep 17 00:00:00 2001 From: Michael Garvin Date: Fri, 8 Jan 2021 15:15:27 -0800 Subject: [PATCH 1/7] fix(docs): clean up `npm uninstall` docs Lots of flags removed, clarification on what `--no-save` does, consolidated examples into a separate section --- docs/content/commands/npm-uninstall.md | 43 +++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index fe3c871138c19..155193e4f17f6 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -7,7 +7,7 @@ description: Remove a package ### Synopsis ```bash -npm uninstall [<@scope>/][@]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save] +npm uninstall [<@scope>/][@]... [--no-save] aliases: remove, rm, r, un, unlink ``` @@ -17,40 +17,39 @@ aliases: remove, rm, r, un, unlink This uninstalls a package, completely removing everything npm installed on its behalf. -Example: +It also removes the package from the `dependencies`, `devDependencies`, +`optionalDependencies`, and `peerDependencies` objects in your +`package.json`. -```bash -npm uninstall sax -``` +Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm +will update those files as well. + +`npm uninstall` takes one optional flag, `--no-save` which will tell npm +not to remove the package from your `package.json`, +`npm-shrinkwrap.json`, or `package-lock.json` files In global mode (ie, with `-g` or `--global` appended to the command), it uninstalls the current package context as a global package. +`--no-save` is ignored in this case. -`npm uninstall` takes 3 exclusive, optional flags which save or update -the package version in your main package.json: - -* `-S, --save`: Package will be removed from your `dependencies`. - -* `-D, --save-dev`: Package will be removed from your `devDependencies`. - -* `-O, --save-optional`: Package will be removed from your `optionalDependencies`. +Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). -* `--no-save`: Package will not be removed from your `package.json` file. +### Examples -Further, if you have an `npm-shrinkwrap.json` then it will be updated as -well. +```bash +npm uninstall sax +``` -Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). +sax will no longer be in your `package.json`, `npm-shrinkwrap.json`, or +`package-lock.json` files. -Examples: ```bash -npm uninstall sax --save -npm uninstall @myorg/privatepackage --save -npm uninstall node-tap --save-dev -npm uninstall dtrace-provider --save-optional npm uninstall lodash --no-save ``` +lodash will not be removed fromy your `package.json`, +`npm-shrinkwrap.json`, or `package-lock.json` files. + ### See Also * [npm prune](/commands/npm-prune) From 4076d397825c68e0db79e66b979dd7bb52424243 Mon Sep 17 00:00:00 2001 From: Michael Garvin Date: Tue, 12 Jan 2021 09:27:37 -0800 Subject: [PATCH 2/7] fix(uninstall): match usage w/ docs --- lib/uninstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uninstall.js b/lib/uninstall.js index 83a0b009699eb..4638adc5f3e89 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -9,7 +9,7 @@ const completion = require('./utils/completion/installed-shallow.js') const usage = usageUtil( 'uninstall', - 'npm uninstall [<@scope>/][@]... [--save-prod|--save-dev|--save-optional] [--no-save]' + 'npm uninstall [<@scope>/][@]... [--no-save]' ) const cmd = (args, cb) => rm(args).then(() => cb()).catch(cb) From 31fd67913a92c3c3d57ac57f40ea77c7dee646ac Mon Sep 17 00:00:00 2001 From: Michael Garvin Date: Tue, 12 Jan 2021 10:41:33 -0800 Subject: [PATCH 3/7] fix(docs): re-add `--save` and explanation of when it is useful --- docs/content/commands/npm-uninstall.md | 12 ++++++++---- lib/uninstall.js | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index 155193e4f17f6..0d7a5bbe9fb95 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -7,7 +7,7 @@ description: Remove a package ### Synopsis ```bash -npm uninstall [<@scope>/][@]... [--no-save] +npm uninstall [<@scope>/][@]... [--save|--no-save] aliases: remove, rm, r, un, unlink ``` @@ -24,9 +24,13 @@ It also removes the package from the `dependencies`, `devDependencies`, Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm will update those files as well. -`npm uninstall` takes one optional flag, `--no-save` which will tell npm -not to remove the package from your `package.json`, -`npm-shrinkwrap.json`, or `package-lock.json` files +`--no-save` will tell npm not to remove the package from your +`package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. + +`--save` will tell npm to remove the package from your `package.json`, +`npm-shrinkwrap.json`, and `package-lock.json` files. This is the +default, but you may need to use this if you have for instance +`save=false` in your `npmrc` file In global mode (ie, with `-g` or `--global` appended to the command), it uninstalls the current package context as a global package. diff --git a/lib/uninstall.js b/lib/uninstall.js index 4638adc5f3e89..f020e95a4ad5f 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -9,7 +9,7 @@ const completion = require('./utils/completion/installed-shallow.js') const usage = usageUtil( 'uninstall', - 'npm uninstall [<@scope>/][@]... [--no-save]' + 'npm uninstall [<@scope>/][@]... [--save, --no-save]' ) const cmd = (args, cb) => rm(args).then(() => cb()).catch(cb) From 7c49bafc35092d43378f78e057c3edb4b717c0a4 Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 12 Jan 2021 11:27:55 -0800 Subject: [PATCH 4/7] Update docs/content/commands/npm-uninstall.md Co-authored-by: Jordan Harband --- docs/content/commands/npm-uninstall.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index 0d7a5bbe9fb95..ff9ee18e1445a 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -51,7 +51,7 @@ sax will no longer be in your `package.json`, `npm-shrinkwrap.json`, or npm uninstall lodash --no-save ``` -lodash will not be removed fromy your `package.json`, +lodash will not be removed from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. ### See Also From eb582436144c08675960de2a77205282e5fd8b28 Mon Sep 17 00:00:00 2001 From: Michael Garvin Date: Tue, 12 Jan 2021 11:33:58 -0800 Subject: [PATCH 5/7] fix(docs): re-add `-S` --- docs/content/commands/npm-uninstall.md | 10 +++++----- lib/uninstall.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index 0d7a5bbe9fb95..77945b5e4692a 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -7,7 +7,7 @@ description: Remove a package ### Synopsis ```bash -npm uninstall [<@scope>/][@]... [--save|--no-save] +npm uninstall [<@scope>/][@]... [-S|--save|--no-save] aliases: remove, rm, r, un, unlink ``` @@ -27,10 +27,10 @@ will update those files as well. `--no-save` will tell npm not to remove the package from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. -`--save` will tell npm to remove the package from your `package.json`, -`npm-shrinkwrap.json`, and `package-lock.json` files. This is the -default, but you may need to use this if you have for instance -`save=false` in your `npmrc` file +`--save` or `-S` will tell npm to remove the package from your +`package.json`, `npm-shrinkwrap.json`, and `package-lock.json` files. +This is the default, but you may need to use this if you have for +instance `save=false` in your `npmrc` file In global mode (ie, with `-g` or `--global` appended to the command), it uninstalls the current package context as a global package. diff --git a/lib/uninstall.js b/lib/uninstall.js index f020e95a4ad5f..15995c0b3cc94 100644 --- a/lib/uninstall.js +++ b/lib/uninstall.js @@ -9,7 +9,7 @@ const completion = require('./utils/completion/installed-shallow.js') const usage = usageUtil( 'uninstall', - 'npm uninstall [<@scope>/][@]... [--save, --no-save]' + 'npm uninstall [<@scope>/][@]... [-S|--save|--no-save]' ) const cmd = (args, cb) => rm(args).then(() => cb()).catch(cb) From c42662a671e38172276bd94480ac6ac630903b1a Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 14 Jan 2021 12:39:48 -0800 Subject: [PATCH 6/7] fix(docs): delineate package name Co-authored-by: Darcy Clarke --- docs/content/commands/npm-uninstall.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index c4da410aa7fc8..058ab5ef4137f 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -44,7 +44,7 @@ Scope is optional and follows the usual rules for [`scope`](/using-npm/scope). npm uninstall sax ``` -sax will no longer be in your `package.json`, `npm-shrinkwrap.json`, or +`sax` will no longer be in your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. ```bash From a850e64cb8718e4c40be9c27fa18a20c2283cb86 Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 14 Jan 2021 12:39:55 -0800 Subject: [PATCH 7/7] fix(docs): delineate package name Co-authored-by: Darcy Clarke --- docs/content/commands/npm-uninstall.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/commands/npm-uninstall.md b/docs/content/commands/npm-uninstall.md index 058ab5ef4137f..258431cbd9f94 100644 --- a/docs/content/commands/npm-uninstall.md +++ b/docs/content/commands/npm-uninstall.md @@ -51,7 +51,7 @@ npm uninstall sax npm uninstall lodash --no-save ``` -lodash will not be removed from your `package.json`, +`lodash` will not be removed from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files. ### See Also