From 49bbb2fb9d56e02d94da652befaa3d445283090b Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 8 Sep 2022 10:01:20 -0700 Subject: [PATCH] feat: remove `npm birthday` (#5455) BREAKING CHANGE: this removes the `npm birthday` command --- lib/commands/birthday.js | 17 ----------------- lib/utils/cmd-list.js | 2 +- .../test/lib/load-all-commands.js.test.cjs | 9 --------- .../test/lib/utils/cmd-list.js.test.cjs | 1 - test/lib/commands/birthday.js | 15 --------------- test/lib/npm.js | 4 ++-- 6 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 lib/commands/birthday.js delete mode 100644 test/lib/commands/birthday.js diff --git a/lib/commands/birthday.js b/lib/commands/birthday.js deleted file mode 100644 index cdd6db6286905..0000000000000 --- a/lib/commands/birthday.js +++ /dev/null @@ -1,17 +0,0 @@ -const BaseCommand = require('../base-command.js') -const log = require('../utils/log-shim') - -class Birthday extends BaseCommand { - static name = 'birthday' - static description = 'Birthday, deprecated' - static ignoreImplicitWorkspace = true - static isShellout = true - - async exec () { - this.npm.config.set('yes', true) - log.warn('birthday', 'birthday is deprecated and will be removed in a future release') - return this.npm.exec('exec', ['@npmcli/npm-birthday']) - } -} - -module.exports = Birthday diff --git a/lib/utils/cmd-list.js b/lib/utils/cmd-list.js index d74f9878fbd15..c712ece0de2ac 100644 --- a/lib/utils/cmd-list.js +++ b/lib/utils/cmd-list.js @@ -138,7 +138,7 @@ const cmdList = [ 'whoami', ] -const plumbing = ['birthday', 'help-search'] +const plumbing = ['help-search'] const abbrevs = abbrev(cmdList.concat(Object.keys(aliases))) module.exports = { diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 251aa0ec6ff20..d4a340431792a 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -57,15 +57,6 @@ Options: Run "npm help audit" for more info ` -exports[`test/lib/load-all-commands.js TAP load each command birthday > must match snapshot 1`] = ` -Birthday, deprecated - -Usage: -npm birthday - -Run "npm help birthday" for more info -` - exports[`test/lib/load-all-commands.js TAP load each command bugs > must match snapshot 1`] = ` Report bugs for a package in a web browser diff --git a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs index 062f9fefd273b..e76f890140b8b 100644 --- a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs +++ b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs @@ -474,7 +474,6 @@ Object { "whoami", ], "plumbing": Array [ - "birthday", "help-search", ], } diff --git a/test/lib/commands/birthday.js b/test/lib/commands/birthday.js deleted file mode 100644 index 9156d3df09421..0000000000000 --- a/test/lib/commands/birthday.js +++ /dev/null @@ -1,15 +0,0 @@ -const t = require('tap') -const { load: loadMockNpm } = require('../../fixtures/mock-npm') - -t.test('birthday', async t => { - t.plan(2) - const { npm } = await loadMockNpm(t, { - mocks: { - libnpmexec: ({ args, yes }) => { - t.ok(yes) - t.match(args, ['@npmcli/npm-birthday']) - }, - }, - }) - await npm.exec('birthday', []) -}) diff --git a/test/lib/npm.js b/test/lib/npm.js index d9201c8a6aa92..135a02cc98a3d 100644 --- a/test/lib/npm.js +++ b/test/lib/npm.js @@ -574,10 +574,10 @@ t.test('aliases and typos', async t => { const { npm } = await loadMockNpm(t, { load: false }) await t.rejects(npm.cmd('thisisnotacommand'), { code: 'EUNKNOWNCOMMAND' }) await t.rejects(npm.cmd(''), { code: 'EUNKNOWNCOMMAND' }) - await t.rejects(npm.cmd('birt'), { code: 'EUNKNOWNCOMMAND' }) + await t.rejects(npm.cmd('birthday'), { code: 'EUNKNOWNCOMMAND' }) await t.resolves(npm.cmd('it'), { name: 'install-test' }) await t.resolves(npm.cmd('installTe'), { name: 'install-test' }) - await t.resolves(npm.cmd('birthday'), { name: 'birthday' }) + await t.resolves(npm.cmd('access'), { name: 'access' }) }) t.test('explicit workspace rejection', async t => {