mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-14 09:42:37 -04:00
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.
This commit is contained in:
6
.changeset/bugs-issues-alias.md
Normal file
6
.changeset/bugs-issues-alias.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/deps.inspection.commands": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
Added the `issues` command as an alias of `bugs`, so `pnpm issues` opens the package's bug tracker URL in the browser.
|
||||
@@ -16,13 +16,16 @@ export function cliOptionsTypes (): Record<string, unknown> {
|
||||
return rcOptionsTypes()
|
||||
}
|
||||
|
||||
export const commandNames = ['bugs']
|
||||
export const commandNames = ['bugs', 'issues']
|
||||
|
||||
export function help (): string {
|
||||
return renderHelp({
|
||||
description: "Opens the URL of the package's bug tracker in a browser.",
|
||||
url: docsUrl('bugs'),
|
||||
usages: ['pnpm bugs [<pkgname> [<pkgname> ...]]'],
|
||||
usages: [
|
||||
'pnpm bugs [<pkgname> [<pkgname> ...]]',
|
||||
'pnpm issues [<pkgname> [<pkgname> ...]]',
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ const BASE_OPTIONS = {
|
||||
test('bugs: command should be available', () => {
|
||||
expect(bugs.handler).toBeDefined()
|
||||
expect(bugs.help).toBeDefined()
|
||||
expect(bugs.commandNames).toEqual(['bugs'])
|
||||
expect(bugs.commandNames).toEqual(['bugs', 'issues'])
|
||||
expect(bugs.help()).toContain('pnpm bugs')
|
||||
expect(bugs.help()).toContain('pnpm issues')
|
||||
})
|
||||
|
||||
test('bugs: opens bugs.url from local manifest', async () => {
|
||||
|
||||
@@ -5,7 +5,6 @@ import type { CommandDefinition } from './index.js'
|
||||
const NOT_IMPLEMENTED_COMMANDS = [
|
||||
'access',
|
||||
'edit',
|
||||
'issues',
|
||||
'profile',
|
||||
'set-script',
|
||||
'team',
|
||||
|
||||
@@ -337,7 +337,12 @@ test('dlx creates cache and store prune cleans cache', async () => {
|
||||
'--allow-build=shx',
|
||||
'--allow-build=shx@https://codeload.github.com/shelljs/shx/tar.gz/61aca968cd7afc712ca61a4fc4ec3201e3770dc7',
|
||||
]
|
||||
await Promise.all(Object.entries(commands).map(([cmd, args]) => execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args])))
|
||||
|
||||
/* eslint-disable no-await-in-loop */
|
||||
for (const [cmd, args] of Object.entries(commands)) {
|
||||
await execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args])
|
||||
}
|
||||
/* eslint-enable no-await-in-loop */
|
||||
|
||||
// ensure that the dlx cache has certain structure
|
||||
const dlxBaseDir = path.resolve('cache', 'dlx')
|
||||
|
||||
13
pnpm11/pnpm/test/parseCliArgs.test.ts
Normal file
13
pnpm11/pnpm/test/parseCliArgs.test.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { expect, test } from '@jest/globals'
|
||||
|
||||
import { getCliOptionsTypes, getCommandFullName, pnpmCmds } from '../src/cmd/index.js'
|
||||
import { parseCliArgs } from '../src/parseCliArgs.js'
|
||||
|
||||
test('the "issues" alias resolves to the "bugs" command', async () => {
|
||||
expect(getCommandFullName('issues')).toBe('bugs')
|
||||
expect(pnpmCmds.issues).toBe(pnpmCmds.bugs)
|
||||
expect(getCliOptionsTypes('issues')).toHaveProperty(['registry'])
|
||||
|
||||
const { cmd } = await parseCliArgs(['issues', 'is-positive'])
|
||||
expect(cmd).toBe('bugs')
|
||||
})
|
||||
Reference in New Issue
Block a user