preFlightRegistryBuild() — ui Function Reference
Architecture documentation for the preFlightRegistryBuild() function in preflight-registry.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD d674c4b8_7415_4a68_3845_f3f43cdee480["preFlightRegistryBuild()"] eee78056_64c2_883e_d1dd_cd61553165e3["preflight-registry.ts"] d674c4b8_7415_4a68_3845_f3f43cdee480 -->|defined in| eee78056_64c2_883e_d1dd_cd61553165e3 style d674c4b8_7415_4a68_3845_f3f43cdee480 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/preflights/preflight-registry.ts lines 10–66
export async function preFlightRegistryBuild(
options: z.infer<typeof buildOptionsSchema>
) {
const errors: Record<string, boolean> = {}
const resolvePaths = {
cwd: options.cwd,
registryFile: path.resolve(options.cwd, options.registryFile),
outputDir: path.resolve(options.cwd, options.outputDir),
}
// Ensure registry file exists.
if (!fs.existsSync(resolvePaths.registryFile)) {
errors[ERRORS.BUILD_MISSING_REGISTRY_FILE] = true
return {
errors,
resolvePaths: null,
config: null,
}
}
// Check for existing components.json file.
if (!fs.existsSync(path.resolve(options.cwd, "components.json"))) {
errors[ERRORS.MISSING_CONFIG] = true
return {
errors,
resolvePaths: null,
config: null,
}
}
// Create output directory if it doesn't exist.
await fs.mkdir(resolvePaths.outputDir, { recursive: true })
try {
const config = await getConfig(options.cwd)
return {
errors,
config: config!,
resolvePaths,
}
} catch (error) {
logger.break()
logger.error(
`An invalid ${highlighter.info(
"components.json"
)} file was found at ${highlighter.info(
options.cwd
)}.\nBefore you can build the registry, you must create a valid ${highlighter.info(
"components.json"
)} file by running the ${highlighter.info("init")} command.`
)
logger.break()
process.exit(1)
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does preFlightRegistryBuild() do?
preFlightRegistryBuild() is a function in the ui codebase, defined in packages/shadcn/src/preflights/preflight-registry.ts.
Where is preFlightRegistryBuild() defined?
preFlightRegistryBuild() is defined in packages/shadcn/src/preflights/preflight-registry.ts at line 10.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free