preflight-init.ts — ui Source File
Architecture documentation for preflight-init.ts, a typescript file in the ui codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 2c33207d_5e31_095b_ecdb_be9749a4d953["preflight-init.ts"] d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5 48a2db16_690d_8450_b9e9_0bd7642157d3["init"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 48a2db16_690d_8450_b9e9_0bd7642157d3 2dce5b77_ae3e_67df_2221_13714429e261["errors"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 2dce5b77_ae3e_67df_2221_13714429e261 24fd9695_7ceb_b1f6_c84e_e349d5356c12["get-project-info"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 24fd9695_7ceb_b1f6_c84e_e349d5356c12 15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f 1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1 a3e9bc4e_1faf_6261_a1db_396981c7761d["spinner"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> a3e9bc4e_1faf_6261_a1db_396981c7761d f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de 6802ce19_522d_e5fb_e458_8826d9f6952e["zod"] 2c33207d_5e31_095b_ecdb_be9749a4d953 --> 6802ce19_522d_e5fb_e458_8826d9f6952e style 2c33207d_5e31_095b_ecdb_be9749a4d953 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import path from "path"
import { initOptionsSchema } from "@/src/commands/init"
import * as ERRORS from "@/src/utils/errors"
import { getProjectInfo } from "@/src/utils/get-project-info"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { spinner } from "@/src/utils/spinner"
import fs from "fs-extra"
import { z } from "zod"
export async function preFlightInit(
options: z.infer<typeof initOptionsSchema>
) {
const errors: Record<string, boolean> = {}
// Ensure target directory exists.
// Check for empty project. We assume if no package.json exists, the project is empty.
if (
!fs.existsSync(options.cwd) ||
!fs.existsSync(path.resolve(options.cwd, "package.json"))
) {
errors[ERRORS.MISSING_DIR_OR_EMPTY_PROJECT] = true
return {
errors,
projectInfo: null,
}
}
const projectSpinner = spinner(`Preflight checks.`, {
silent: options.silent,
}).start()
if (
fs.existsSync(path.resolve(options.cwd, "components.json")) &&
!options.force
) {
projectSpinner?.fail()
logger.break()
logger.error(
`A ${highlighter.info(
"components.json"
)} file already exists at ${highlighter.info(
options.cwd
)}.\nTo start over, remove the ${highlighter.info(
"components.json"
)} file and run ${highlighter.info("init")} again.`
)
logger.break()
process.exit(1)
}
projectSpinner?.succeed()
const frameworkSpinner = spinner(`Verifying framework.`, {
silent: options.silent,
}).start()
const projectInfo = await getProjectInfo(options.cwd)
if (!projectInfo || projectInfo?.framework.name === "manual") {
errors[ERRORS.UNSUPPORTED_FRAMEWORK] = true
frameworkSpinner?.fail()
// ... (103 more lines)
Domain
Subdomains
Functions
Dependencies
- errors
- fs-extra
- get-project-info
- highlighter
- init
- logger
- path
- spinner
- zod
Source
Frequently Asked Questions
What does preflight-init.ts do?
preflight-init.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, CLICore subdomain.
What functions are defined in preflight-init.ts?
preflight-init.ts defines 1 function(s): preFlightInit.
What does preflight-init.ts depend on?
preflight-init.ts imports 9 module(s): errors, fs-extra, get-project-info, highlighter, init, logger, path, spinner, and 1 more.
Where is preflight-init.ts in the architecture?
preflight-init.ts is located at packages/shadcn/src/preflights/preflight-init.ts (domain: FrameworkTooling, subdomain: CLICore, 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