Skip to content

Commit e2e3c81

Browse files
authored
feat: add issues alias to bugs command (#12734)
Add the `issues` alias to the `bugs` command in the TypeScript CLI, so that `pnpm issues <pkg>` behaves identically to `pnpm bugs <pkg>`. The alias is registered via the bugs command's commandNames, removed from the not-implemented command list, shown in the help output, and covered by a CLI-level alias-resolution test. The pacquet CLI already ships the same alias.
1 parent 1e81761 commit e2e3c81

6 files changed

Lines changed: 33 additions & 5 deletions

File tree

‎.changeset/bugs-issues-alias.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pnpm/deps.inspection.commands": minor
3+
"pnpm": minor
4+
---
5+
6+
Added the `issues` command as an alias of `bugs`, so `pnpm issues` opens the package's bug tracker URL in the browser.

‎pnpm11/deps/inspection/commands/src/bugs/index.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ export function cliOptionsTypes (): Record<string, unknown> {
1616
return rcOptionsTypes()
1717
}
1818

19-
export const commandNames = ['bugs']
19+
export const commandNames = ['bugs', 'issues']
2020

2121
export function help (): string {
2222
return renderHelp({
2323
description: "Opens the URL of the package's bug tracker in a browser.",
2424
url: docsUrl('bugs'),
25-
usages: ['pnpm bugs [<pkgname> [<pkgname> ...]]'],
25+
usages: [
26+
'pnpm bugs [<pkgname> [<pkgname> ...]]',
27+
'pnpm issues [<pkgname> [<pkgname> ...]]',
28+
],
2629
})
2730
}
2831

‎pnpm11/deps/inspection/commands/test/bugs.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ const BASE_OPTIONS = {
2222
test('bugs: command should be available', () => {
2323
expect(bugs.handler).toBeDefined()
2424
expect(bugs.help).toBeDefined()
25-
expect(bugs.commandNames).toEqual(['bugs'])
25+
expect(bugs.commandNames).toEqual(['bugs', 'issues'])
26+
expect(bugs.help()).toContain('pnpm bugs')
27+
expect(bugs.help()).toContain('pnpm issues')
2628
})
2729

2830
test('bugs: opens bugs.url from local manifest', async () => {

‎pnpm11/pnpm/src/cmd/notImplemented.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { CommandDefinition } from './index.js'
55
const NOT_IMPLEMENTED_COMMANDS = [
66
'access',
77
'edit',
8-
'issues',
98
'profile',
109
'set-script',
1110
'team',

‎pnpm11/pnpm/test/dlx.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,12 @@ test('dlx creates cache and store prune cleans cache', async () => {
337337
'--allow-build=shx',
338338
'--allow-build=shx@https://codeload.github.com/shelljs/shx/tar.gz/61aca968cd7afc712ca61a4fc4ec3201e3770dc7',
339339
]
340-
await Promise.all(Object.entries(commands).map(([cmd, args]) => execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args])))
340+
341+
/* eslint-disable no-await-in-loop */
342+
for (const [cmd, args] of Object.entries(commands)) {
343+
await execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args])
344+
}
345+
/* eslint-enable no-await-in-loop */
341346

342347
// ensure that the dlx cache has certain structure
343348
const dlxBaseDir = path.resolve('cache', 'dlx')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expect, test } from '@jest/globals'
2+
3+
import { getCliOptionsTypes, getCommandFullName, pnpmCmds } from '../src/cmd/index.js'
4+
import { parseCliArgs } from '../src/parseCliArgs.js'
5+
6+
test('the "issues" alias resolves to the "bugs" command', async () => {
7+
expect(getCommandFullName('issues')).toBe('bugs')
8+
expect(pnpmCmds.issues).toBe(pnpmCmds.bugs)
9+
expect(getCliOptionsTypes('issues')).toHaveProperty(['registry'])
10+
11+
const { cmd } = await parseCliArgs(['issues', 'is-positive'])
12+
expect(cmd).toBe('bugs')
13+
})

0 commit comments

Comments
 (0)