Skip to content

Commit 1114f1a

Browse files
committed
fix: add support for 'custom' mode in PackageManagerTabs for flexible package management commands
1 parent c4ebec4 commit 1114f1a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/components/PackageManagerTabs.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CodeBlock } from './CodeBlock'
77
import type { Framework } from '~/libraries/types'
88

99
type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'
10-
type InstallMode = 'install' | 'dev-install' | 'local-install' | 'create'
10+
type InstallMode = 'install' | 'dev-install' | 'local-install' | 'create' | 'custom'
1111

1212
// Use zustand for cross-component synchronization
1313
// This ensures all PackageManagerTabs instances on the page stay in sync
@@ -41,6 +41,26 @@ function getInstallCommand(
4141
): string[] {
4242
const commands: string[] = []
4343

44+
if (mode === 'custom') {
45+
for (const packages of packageGroups) {
46+
const pkgStr = packages.join(' ')
47+
switch (packageManager) {
48+
case 'npm':
49+
commands.push(`npm ${pkgStr}`)
50+
break
51+
case 'pnpm':
52+
commands.push(`pnpm ${pkgStr}`)
53+
break
54+
case 'yarn':
55+
commands.push(`yarn ${pkgStr}`)
56+
break
57+
case 'bun':
58+
commands.push(`bun ${pkgStr}`)
59+
break
60+
}
61+
}
62+
}
63+
4464
if (mode === 'create') {
4565
for (const packages of packageGroups) {
4666
const pkgStr = packages.join(' ')

0 commit comments

Comments
 (0)