From 6d57111fa13228b40ec7518b750d5b6ea945583d Mon Sep 17 00:00:00 2001 From: Amal Hussein Date: Mon, 27 Jan 2020 17:37:28 -0500 Subject: [PATCH 1/4] chore(docs): update unpublish docs with both commands, removing policy info from cli docs, and added reference to unpublish policy docs --- docs/content/cli-commands/npm-unpublish.md | 26 +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/docs/content/cli-commands/npm-unpublish.md b/docs/content/cli-commands/npm-unpublish.md index 5348023d9a840..0e678b4971c2c 100644 --- a/docs/content/cli-commands/npm-unpublish.md +++ b/docs/content/cli-commands/npm-unpublish.md @@ -10,19 +10,21 @@ description: Remove a package from the registry ### Synopsis +#### Unpublishing a single version of a package + ```bash -npm unpublish [<@scope>/][@] +npm unpublish @ ``` -### Warning +#### Unpublishing an entire package -**It is generally considered bad behavior to remove versions of a library -that others are depending on!** +```bash +npm unpublish -f +``` -Consider using the `deprecate` command -instead, if your intent is to encourage users to upgrade. +### Warning -There is plenty of room on the registry. +Consider using the `deprecate` command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package. ### Description @@ -34,16 +36,10 @@ the root package entry is removed from the registry entirely. Even if a package version is unpublished, that specific name and version combination can never be reused. In order to publish the -package again, a new version number must be used. Additionally, -new versions of packages with every version unpublished may not -be republished until 24 hours have passed. +package again, a new version number must be used. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed. -With the default registry (`registry.npmjs.org`), unpublish is -only allowed with versions published in the last 72 hours. If you -are trying to unpublish a version published longer ago than that, -contact support@npmjs.com. +To learn more about how unpublish is treated on the npm registry, see our unpublish policies. -The scope is optional and follows the usual rules for [`scope`](/using-npm/scope). ### See Also From 0f69df2b718e1cfee5fb44da44cd30f11b1f21d5 Mon Sep 17 00:00:00 2001 From: Amal Hussein <6717823+nomadtechie@users.noreply.github.com> Date: Mon, 27 Jan 2020 17:40:03 -0600 Subject: [PATCH 2/4] Apply suggestions from code review Co-Authored-By: Michael 'afrolion' Perrotte --- docs/content/cli-commands/npm-unpublish.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/cli-commands/npm-unpublish.md b/docs/content/cli-commands/npm-unpublish.md index 0e678b4971c2c..c40f480a8bcb8 100644 --- a/docs/content/cli-commands/npm-unpublish.md +++ b/docs/content/cli-commands/npm-unpublish.md @@ -13,13 +13,13 @@ description: Remove a package from the registry #### Unpublishing a single version of a package ```bash -npm unpublish @ +npm unpublish [<@scope>/]@ ``` #### Unpublishing an entire package ```bash -npm unpublish -f +npm unpublish [<@scope>/] --force ``` ### Warning From 0e8f6f356ad2310b34b63dd5581ef69fc636929c Mon Sep 17 00:00:00 2001 From: Amal Hussein Date: Mon, 27 Jan 2020 19:03:39 -0500 Subject: [PATCH 3/4] chore: updated unpublish cmd help usage guide --- lib/unpublish.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/unpublish.js b/lib/unpublish.js index 203c8b592f109..f087a6c854256 100644 --- a/lib/unpublish.js +++ b/lib/unpublish.js @@ -20,7 +20,11 @@ const readJson = BB.promisify(require('read-package-json')) const usage = require('./utils/usage.js') const whoami = BB.promisify(require('./whoami.js')) -unpublish.usage = usage('npm unpublish [<@scope>/][@]') +unpublish.usage = usage( + 'unpublish', + '\nnpm unpublish [<@scope>/]@' + + '\nnpm unpublish [<@scope>/] --force' +) function UsageError () { throw Object.assign(new Error(`Usage: ${unpublish.usage}`), { From f38746e7584b1fe7b1fcccea3f12830777399ccd Mon Sep 17 00:00:00 2001 From: Amal Hussein Date: Tue, 25 Feb 2020 16:04:17 -0500 Subject: [PATCH 4/4] chore: linting fix --- lib/unpublish.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/unpublish.js b/lib/unpublish.js index f087a6c854256..59d7d1b5887d2 100644 --- a/lib/unpublish.js +++ b/lib/unpublish.js @@ -21,8 +21,8 @@ const usage = require('./utils/usage.js') const whoami = BB.promisify(require('./whoami.js')) unpublish.usage = usage( - 'unpublish', - '\nnpm unpublish [<@scope>/]@' + + 'unpublish', + '\nnpm unpublish [<@scope>/]@' + '\nnpm unpublish [<@scope>/] --force' ) @@ -79,7 +79,7 @@ function unpublish (args, cb) { 'Refusing to delete entire project.\n' + 'Run with --force to do this.\n' + unpublish.usage - ), {code: 'EUSAGE'}) + ), { code: 'EUSAGE' }) } if (!spec || path.resolve(spec.name) === npm.localPrefix) { // if there's a package.json in the current folder, then