preflight-registry.ts — ui Source File
Architecture documentation for preflight-registry.ts, a typescript file in the ui codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR eee78056_64c2_883e_d1dd_cd61553165e3["preflight-registry.ts"] d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] eee78056_64c2_883e_d1dd_cd61553165e3 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 155647d9_3e72_65ae_12f7_60df12f47231["build"] eee78056_64c2_883e_d1dd_cd61553165e3 --> 155647d9_3e72_65ae_12f7_60df12f47231 2dce5b77_ae3e_67df_2221_13714429e261["errors"] eee78056_64c2_883e_d1dd_cd61553165e3 --> 2dce5b77_ae3e_67df_2221_13714429e261 b2895591_2a74_d518_deda_2f26be766dcb["get-config"] eee78056_64c2_883e_d1dd_cd61553165e3 --> b2895591_2a74_d518_deda_2f26be766dcb 15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"] eee78056_64c2_883e_d1dd_cd61553165e3 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f 1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"] eee78056_64c2_883e_d1dd_cd61553165e3 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1 f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"] eee78056_64c2_883e_d1dd_cd61553165e3 --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de 6802ce19_522d_e5fb_e458_8826d9f6952e["zod"] eee78056_64c2_883e_d1dd_cd61553165e3 --> 6802ce19_522d_e5fb_e458_8826d9f6952e style eee78056_64c2_883e_d1dd_cd61553165e3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from "path"
import { buildOptionsSchema } from "@/src/commands/build"
import * as ERRORS from "@/src/utils/errors"
import { getConfig } from "@/src/utils/get-config"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import fs from "fs-extra"
import { z } from "zod"
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
Functions
Dependencies
- build
- errors
- fs-extra
- get-config
- highlighter
- logger
- path
- zod
Source
Frequently Asked Questions
What does preflight-registry.ts do?
preflight-registry.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in preflight-registry.ts?
preflight-registry.ts defines 1 function(s): preFlightRegistryBuild.
What does preflight-registry.ts depend on?
preflight-registry.ts imports 8 module(s): build, errors, fs-extra, get-config, highlighter, logger, path, zod.
Where is preflight-registry.ts in the architecture?
preflight-registry.ts is located at packages/shadcn/src/preflights/preflight-registry.ts (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/src/preflights).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free