getFullCustomCommand() — vite Function Reference
Architecture documentation for the getFullCustomCommand() function in index.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 15ac042d_7ddf_e44d_028d_9bf4155c4e45["getFullCustomCommand()"] ebed723b_f143_390f_439d_dfaa680d6d16["index.ts"] 15ac042d_7ddf_e44d_028d_9bf4155c4e45 -->|defined in| ebed723b_f143_390f_439d_dfaa680d6d16 6d5b7f61_22fe_5498_a292_5c478890d5f3["init()"] 6d5b7f61_22fe_5498_a292_5c478890d5f3 -->|calls| 15ac042d_7ddf_e44d_028d_9bf4155c4e45 style 15ac042d_7ddf_e44d_028d_9bf4155c4e45 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/create-vite/src/index.ts lines 869–915
function getFullCustomCommand(customCommand: string, pkgInfo?: PkgInfo) {
const pkgManager = pkgInfo ? pkgInfo.name : 'npm'
const isYarn1 = pkgManager === 'yarn' && pkgInfo?.version.startsWith('1.')
return (
customCommand
.replace(/^npm create (?:-- )?/, () => {
// `bun create` uses it's own set of templates,
// the closest alternative is using `bun x` directly on the package
if (pkgManager === 'bun') {
return 'bun x create-'
}
// Deno uses `run -A npm:create-` instead of `create` or `init` to also provide needed perms
if (pkgManager === 'deno') {
return 'deno run -A npm:create-'
}
// pnpm doesn't support the -- syntax
if (pkgManager === 'pnpm') {
return 'pnpm create '
}
// For other package managers, preserve the original format
return customCommand.startsWith('npm create -- ')
? `${pkgManager} create -- `
: `${pkgManager} create `
})
// Only Yarn 1.x doesn't support `@version` in the `create` command
.replace('@latest', () => (isYarn1 ? '' : '@latest'))
.replace(/^npm exec /, () => {
// Prefer `pnpm dlx`, `yarn dlx`, or `bun x`
if (pkgManager === 'pnpm') {
return 'pnpm dlx '
}
if (pkgManager === 'yarn' && !isYarn1) {
return 'yarn dlx '
}
if (pkgManager === 'bun') {
return 'bun x '
}
if (pkgManager === 'deno') {
return 'deno run -A npm:'
}
// Use `npm exec` in all other cases,
// including Yarn 1.x and other custom npm clients.
return 'npm exec '
})
)
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getFullCustomCommand() do?
getFullCustomCommand() is a function in the vite codebase, defined in packages/create-vite/src/index.ts.
Where is getFullCustomCommand() defined?
getFullCustomCommand() is defined in packages/create-vite/src/index.ts at line 869.
What calls getFullCustomCommand()?
getFullCustomCommand() is called by 1 function(s): init.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free