Skip to content

Commit 507ded2

Browse files
committed
Fix highlighting
1 parent 315dbf2 commit 507ded2

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

app/utils/run-command.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ export interface RunCommandOptions {
6363

6464
/**
6565
* Generate run command as an array of parts.
66-
* For example: ["npx", "eslint"] or ["bunx", "tsc"]
66+
* First element is the package manager label (e.g., "pnpm"), rest are arguments.
67+
* For example: ["pnpm", "dlx", "nuxt"] or ["npx", "eslint"]
6768
*/
6869
export function getRunCommandParts(options: RunCommandOptions): string[] {
6970
const pm = packageManagers.find(p => p.id === options.packageManager)
7071
if (!pm) return []
7172

7273
const spec = getPackageSpecifier(options)
74+
// Split execute command (e.g., "pnpm dlx" -> ["pnpm", "dlx"])
75+
const executeParts = pm.execute.split(' ')
7376

7477
// For deno, always use the package specifier
7578
if (options.packageManager === 'deno') {
76-
return [pm.execute, spec]
79+
return [...executeParts, spec]
7780
}
7881

7982
// For npx/bunx/pnpm dlx/yarn dlx/vlt x, the command name is what gets executed
@@ -86,13 +89,13 @@ export function getRunCommandParts(options: RunCommandOptions): string[] {
8689
: options.packageName
8790
// If command matches base package name, use the package spec
8891
if (options.command === baseName) {
89-
return [pm.execute, spec]
92+
return [...executeParts, spec]
9093
}
9194
// Otherwise use the command name directly (e.g., npx tsc, not npx typescript/tsc)
92-
return [pm.execute, options.command]
95+
return [...executeParts, options.command]
9396
}
9497

95-
return [pm.execute, spec]
98+
return [...executeParts, spec]
9699
}
97100

98101
/**

test/unit/run-command.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ describe('executable detection and run commands', () => {
7474
describe('getRunCommandParts', () => {
7575
it.each([
7676
['npm', ['npx', 'eslint']],
77-
['pnpm', ['pnpm dlx', 'eslint']],
78-
['yarn', ['yarn dlx', 'eslint']],
77+
['pnpm', ['pnpm', 'dlx', 'eslint']],
78+
['yarn', ['yarn', 'dlx', 'eslint']],
7979
['bun', ['bunx', 'eslint']],
80-
['deno', ['deno run', 'npm:eslint']],
81-
['vlt', ['vlt x', 'eslint']],
80+
['deno', ['deno', 'run', 'npm:eslint']],
81+
['vlt', ['vlt', 'x', 'eslint']],
8282
] as const)('%s → %s', (pm, expected) => {
8383
expect(
8484
getRunCommandParts({

0 commit comments

Comments
 (0)