feat: add npm undeprecate command · npm/cli@1764a37 · GitHub
Skip to content

Commit 1764a37

Browse files
committed
feat: add npm undeprecate command
1 parent ab9ddc0 commit 1764a37

11 files changed

Lines changed: 175 additions & 27 deletions

File tree

docs/lib/check-nav.js

Lines changed: 3 additions & 3 deletions
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: npm-undeprecate
3+
section: 1
4+
description: Undeprecate a version of a package
5+
---
6+
7+
### Synopsis
8+
9+
<!-- AUTOGENERATED USAGE DESCRIPTIONS -->
10+
11+
### Description
12+
13+
This command will update the npm registry entry for a package, removing any
14+
deprecation warnings that currently exist.
15+
16+
It works in the same way as [npm deprecate](/commands/npm-deprecate), except
17+
that this command removes deprecation warnings instead of adding them.
18+
19+
### Configuration
20+
21+
<!-- AUTOGENERATED CONFIG DESCRIPTIONS -->
22+
### See Also
23+
24+
* [npm deprecate](/commands/npm-deprecate)

docs/lib/content/nav.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@
177177
- title: npm token
178178
url: /commands/npm-token
179179
description: Manage your authentication tokens
180+
- title: npm undeprecate
181+
url: /commands/npm-undeprecate
182+
description: Undeprecate a version of a package
180183
- title: npm uninstall
181184
url: /commands/npm-uninstall
182185
description: Remove a package

lib/commands/undeprecate.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const Deprecate = require('./deprecate.js')
2+
3+
class Undeprecate extends Deprecate {
4+
static description = 'Undeprecate a version of a package'
5+
static name = 'undeprecate'
6+
static usage = ['<package-spec>']
7+
8+
async exec ([pkg]) {
9+
return super.exec([pkg, ''])
10+
}
11+
}
12+
13+
module.exports = Undeprecate

lib/utils/cmd-list.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const commands = [
6262
'team',
6363
'test',
6464
'token',
65+
'undeprecate',
6566
'uninstall',
6667
'unpublish',
6768
'unstar',

smoke-tests/tap-snapshots/test/index.js.test.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ All commands:
2929
ping, pkg, prefix, profile, prune, publish, query, rebuild,
3030
repo, restart, root, run-script, sbom, search, set,
3131
shrinkwrap, star, stars, start, stop, team, test, token,
32-
uninstall, unpublish, unstar, update, version, view, whoami
32+
undeprecate, uninstall, unpublish, unstar, update, version,
33+
view, whoami
3334
3435
Specify configs in the ini-formatted file:
3536
{NPM}/{TESTDIR}/home/.npmrc

tap-snapshots/test/lib/commands/completion.js.test.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Array [
100100
team
101101
test
102102
token
103+
undeprecate
103104
uninstall
104105
unpublish
105106
unstar

tap-snapshots/test/lib/commands/publish.js.test.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Object {
208208
"man/man1/npm-team.1",
209209
"man/man1/npm-test.1",
210210
"man/man1/npm-token.1",
211+
"man/man1/npm-undeprecate.1",
211212
"man/man1/npm-uninstall.1",
212213
"man/man1/npm-unpublish.1",
213214
"man/man1/npm-unstar.1",

tap-snapshots/test/lib/docs.js.test.cjs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Array [
155155
"team",
156156
"test",
157157
"token",
158+
"undeprecate",
158159
"uninstall",
159160
"unpublish",
160161
"unstar",
@@ -2850,7 +2851,7 @@ Usage:
28502851
npm deprecate <package-spec> <message>
28512852
28522853
Options:
2853-
[--registry <registry>] [--otp <otp>]
2854+
[--registry <registry>] [--otp <otp>] [--dry-run]
28542855
28552856
Run "npm help deprecate" for more info
28562857
@@ -2862,6 +2863,7 @@ Note: This command is unaware of workspaces.
28622863
28632864
#### \`registry\`
28642865
#### \`otp\`
2866+
#### \`dry-run\`
28652867
`
28662868

28672869
exports[`test/lib/docs.js TAP usage diff > must match snapshot 1`] = `
@@ -4274,6 +4276,28 @@ Note: This command is unaware of workspaces.
42744276
#### \`otp\`
42754277
`
42764278

4279+
exports[`test/lib/docs.js TAP usage undeprecate > must match snapshot 1`] = `
4280+
Undeprecate a version of a package
4281+
4282+
Usage:
4283+
npm undeprecate <package-spec>
4284+
4285+
Options:
4286+
[--registry <registry>] [--otp <otp>] [--dry-run]
4287+
4288+
Run "npm help undeprecate" for more info
4289+
4290+
\`\`\`bash
4291+
npm undeprecate <package-spec>
4292+
\`\`\`
4293+
4294+
Note: This command is unaware of workspaces.
4295+
4296+
#### \`registry\`
4297+
#### \`otp\`
4298+
#### \`dry-run\`
4299+
`
4300+
42774301
exports[`test/lib/docs.js TAP usage uninstall > must match snapshot 1`] = `
42784302
Remove a package
42794303

tap-snapshots/test/lib/npm.js.test.cjs

Lines changed: 30 additions & 22 deletions

0 commit comments

Comments
 (0)