unpublish: docs for how to deprecate a package

Edward Thomson committed Aug 17, 2021 at 22:15 UTC 1dbd8d28dcebf29c7662e81e624dbe9dc8b4b279
1 file changed +44 -6
content/packages-and-modules/updating-and-managing-your-published-packages/deprecating-and-undeprecating-packages-or-package-versions.mdx
+44 -6
@@ -1,6 +1,7 @@
1 ---
2 title: Deprecating and undeprecating packages or package versions
3 ---
4 +import shared from '../../../src/shared.js'
5
6 If you no longer wish to maintain a package, or if you would like to encourage users to update to a new or different version, you can [deprecate][deprecate-cli] it. Deprecating a package or version will print a message to the terminal when a user installs it.
7
@@ -12,14 +13,49 @@ A deprecation warning or message can say anything. You may wish to include a mes
13
14 </Note>
15
15 -## Deprecating an entire package or a single version of a package
16 +## Deprecating an entire package
17
17 -### Deprecating an entire package
18 -
19 -Deprecating an entire package will remove it from search results on the npm website, and a deprecation message will also be displayed on the package page.
18 +Deprecating an entire package will remove it from search results on the
19 +npm website, and a deprecation message will also be displayed on the
20 +package page.
21
22 <Screenshot src="/packages-and-modules/updating-and-managing-your-published-packages/deprecate-package.png" alt="Screenshot of package deprecation" />
23
24 +Deprecating a package is an alternative to unpublishing a package if
25 +your package does not meet the
26 +[unpublishing requirements](/policies/unpublish).
27 +
28 +### Using the website
29 +
30 +1. <>{shared["user-login"].text}</>
31 +
32 + <>{shared["user-login"].image}</>
33 +
34 +2. Navigate to the package page for the package you want to unpublish, replacing `<your-package-name>` with the name of your package:
35 + `https://www.npmjs.com/package/<your-package-name>`.
36 +
37 +3. Click **Settings**.
38 + <Screenshot
39 + src="/packages-and-modules/securing-your-code/2fa-package-admin.png"
40 + alt="Screenshot showing the settings tab on a package page"
41 + />
42 +
43 +4. Under "deprecate package", click <strong>Deprecate package</strong>.
44 +
45 + <Screenshot
46 + src="/packages-and-modules/deleting-deprecating/deprecate-package-settings.png"
47 + alt="Screenshot showing the deprecate package button"
48 + />
49 +
50 +5. If you are sure that you want to continue, enter your package name and click <strong>Deprecate package</strong>.
51 +
52 + <Screenshot
53 + src="packages-and-modules/deleting-deprecating/deprecate-package-confirm.png"
54 + alt="Screenshot showing the deprecate package confirmation"
55 + />
56 +
57 +### Using the command line
58 +
59 To deprecate an entire package, run the following command, replacing `<package-name>` with the name of your package, and `"<message>"` with your deprecation message:
60
61 ```
@@ -28,12 +64,14 @@ npm deprecate <package-name> "<message>"
64
65 If you have enabled [two-factor authentication][two-factor-auth], add a one-time password to the command, `--otp=123456` (where *123456* is the code from your authenticator app).
66
31 -### Deprecating a single version of a package
67 +## Deprecating a single version of a package
68
33 -When you deprecate a version fo a package, a red message will be displayed on that version's package page, similar to deprecating an entire package.
69 +When you deprecate a version of a package, a red message will be displayed on that version's package page, similar to deprecating an entire package.
70
71 <Screenshot src="/packages-and-modules/updating-and-managing-your-published-packages/deprecate-version.png" alt="Screenshot of package deprecation for a particular version" />
72
73 +### Using the command line
74 +
75 To deprecate a package version, run the following command, replacing `<package-name>` with the name of your package, `<version>` with your version number, and `"<message>"` with your deprecation message:
76
77 ```