Home / File/ preflight-build.ts — ui Source File

preflight-build.ts — ui Source File

Architecture documentation for preflight-build.ts, a typescript file in the ui codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  4dac1431_8d6a_f958_0884_e5d642f3cb8b["preflight-build.ts"]
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  155647d9_3e72_65ae_12f7_60df12f47231["build"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> 155647d9_3e72_65ae_12f7_60df12f47231
  2dce5b77_ae3e_67df_2221_13714429e261["errors"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> 2dce5b77_ae3e_67df_2221_13714429e261
  15e8bad0_00cc_3d96_8e33_2f062120ea7f["highlighter"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> 15e8bad0_00cc_3d96_8e33_2f062120ea7f
  1df8bbed_5110_29f0_12f0_996fc7a1eda1["logger"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> 1df8bbed_5110_29f0_12f0_996fc7a1eda1
  f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  4dac1431_8d6a_f958_0884_e5d642f3cb8b --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  style 4dac1431_8d6a_f958_0884_e5d642f3cb8b 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 { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import fs from "fs-extra"
import { z } from "zod"

export async function preFlightBuild(
  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
  }

  // Create output directory if it doesn't exist.
  await fs.mkdir(resolvePaths.outputDir, { recursive: true })

  if (Object.keys(errors).length > 0) {
    if (errors[ERRORS.BUILD_MISSING_REGISTRY_FILE]) {
      logger.break()
      logger.error(
        `The path ${highlighter.info(
          resolvePaths.registryFile
        )} does not exist.`
      )
    }

    logger.break()
    process.exit(1)
  }

  return {
    errors,
    resolvePaths,
  }
}

Subdomains

Functions

Dependencies

  • build
  • errors
  • fs-extra
  • highlighter
  • logger
  • path
  • zod

Frequently Asked Questions

What does preflight-build.ts do?
preflight-build.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, TemplateSync subdomain.
What functions are defined in preflight-build.ts?
preflight-build.ts defines 1 function(s): preFlightBuild.
What does preflight-build.ts depend on?
preflight-build.ts imports 7 module(s): build, errors, fs-extra, highlighter, logger, path, zod.
Where is preflight-build.ts in the architecture?
preflight-build.ts is located at packages/shadcn/src/preflights/preflight-build.ts (domain: FrameworkTooling, subdomain: TemplateSync, 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