MCPcopy Create free account
hub / github.com/TanStack/cli / parseExecuteCommand

Function parseExecuteCommand

packages/create/src/package-manager.ts:116–139  ·  view source on GitHub ↗
(
  command: string,
  args: Array<string>,
)

Source from the content-addressed store, hash-verified

114}
115
116function parseExecuteCommand(
117 command: string,
118 args: Array<string>,
119): { pkg: string; args: Array<string> } | null {
120 if (command === 'npx') {
121 const filtered = args[0] === '-y' ? args.slice(1) : args
122 const [pkg, ...rest] = filtered
123 return pkg ? { pkg, args: rest } : null
124 }
125 if (command === 'pnpx' || command === 'bunx') {
126 const filtered = command === 'bunx' && args[0] === '--bun' ? args.slice(1) : args
127 const [pkg, ...rest] = filtered
128 return pkg ? { pkg, args: rest } : null
129 }
130 if ((command === 'pnpm' || command === 'yarn') && args[0] === 'dlx') {
131 const [, pkg, ...rest] = args
132 return pkg ? { pkg, args: rest } : null
133 }
134 if (command === 'deno' && args[0] === 'run' && args[1]?.startsWith('npm:')) {
135 const pkg = args[1].slice(4)
136 return pkg ? { pkg, args: args.slice(2) } : null
137 }
138 return null
139}
140
141export function packageManagerExecute(
142 environment: Environment,

Callers 1

translateExecuteCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected