Skip to content

Commit f9248c0

Browse files
Amal Husseindarcyclarke
authored andcommitted
chore(docs): update unpublish docs with both commands, removing policy info from cli docs, and added reference to unpublish policy docs
Co-Authored-By: Michael 'afrolion' Perrotte <[email protected]> PR-URL: #730 Credit: @nomadtechie Close: #730 Reviewed-by: @darcyclarke
1 parent 3b9c135 commit f9248c0

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

docs/content/cli-commands/npm-unpublish.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,21 @@ description: Remove a package from the registry
1010

1111
### Synopsis
1212

13+
#### Unpublishing a single version of a package
14+
1315
```bash
14-
npm unpublish [<@scope>/]<pkg>[@<version>]
16+
npm unpublish [<@scope>/]<pkg>@<version>
1517
```
1618

17-
### Warning
19+
#### Unpublishing an entire package
1820

19-
**It is generally considered bad behavior to remove versions of a library
20-
that others are depending on!**
21+
```bash
22+
npm unpublish [<@scope>/]<pkg> --force
23+
```
2124

22-
Consider using the `deprecate` command
23-
instead, if your intent is to encourage users to upgrade.
25+
### Warning
2426

25-
There is plenty of room on the registry.
27+
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.
2628

2729
### Description
2830

@@ -34,16 +36,10 @@ the root package entry is removed from the registry entirely.
3436

3537
Even if a package version is unpublished, that specific name and
3638
version combination can never be reused. In order to publish the
37-
package again, a new version number must be used. Additionally,
38-
new versions of packages with every version unpublished may not
39-
be republished until 24 hours have passed.
39+
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.
4040

41-
With the default registry (`registry.npmjs.org`), unpublish is
42-
only allowed with versions published in the last 72 hours. If you
43-
are trying to unpublish a version published longer ago than that,
44-
41+
To learn more about how unpublish is treated on the npm registry, see our <a href="https://www.npmjs.com/policies/unpublish" target="_blank" rel="noopener noreferrer"> unpublish policies</a>.
4542

46-
The scope is optional and follows the usual rules for [`scope`](/using-npm/scope).
4743

4844
### See Also
4945

lib/unpublish.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const readJson = BB.promisify(require('read-package-json'))
2020
const usage = require('./utils/usage.js')
2121
const whoami = BB.promisify(require('./whoami.js'))
2222

23-
unpublish.usage = usage('npm unpublish [<@scope>/]<pkg>[@<version>]')
23+
unpublish.usage = usage(
24+
'unpublish',
25+
'\nnpm unpublish [<@scope>/]<pkg>@<version>' +
26+
'\nnpm unpublish [<@scope>/]<pkg> --force'
27+
)
2428

2529
function UsageError () {
2630
throw Object.assign(new Error(`Usage: ${unpublish.usage}`), {
@@ -75,7 +79,7 @@ function unpublish (args, cb) {
7579
'Refusing to delete entire project.\n' +
7680
'Run with --force to do this.\n' +
7781
unpublish.usage
78-
), {code: 'EUSAGE'})
82+
), { code: 'EUSAGE' })
7983
}
8084
if (!spec || path.resolve(spec.name) === npm.localPrefix) {
8185
// if there's a package.json in the current folder, then

0 commit comments

Comments
 (0)