Home / File/ get-project-info.ts — ui Source File

get-project-info.ts — ui Source File

Architecture documentation for get-project-info.ts, a typescript file in the ui codebase. 9 imports, 5 dependents.

File typescript FrameworkTooling TemplateSync 9 imports 5 dependents 10 functions

Entity Profile

Dependency Diagram

graph LR
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe["get-project-info.ts"]
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  a3b2545e_3d8c_699d_ef11_6ab18db14666["schema"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> a3b2545e_3d8c_699d_ef11_6ab18db14666
  ec401051_7082_86aa_a320_52f519281e9e["frameworks"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> ec401051_7082_86aa_a320_52f519281e9e
  b2895591_2a74_d518_deda_2f26be766dcb["get-config"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> b2895591_2a74_d518_deda_2f26be766dcb
  52d51853_b453_3159_f5fc_2e8fcdf57c5f["get-package-info"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> 52d51853_b453_3159_f5fc_2e8fcdf57c5f
  587e4732_d484_82b5_c4de_af2e9f20d031["fast-glob"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> 587e4732_d484_82b5_c4de_af2e9f20d031
  f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de
  67c3fcb7_babc_5ba5_b887_30779f599239["tsconfig-paths"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> 67c3fcb7_babc_5ba5_b887_30779f599239
  6802ce19_522d_e5fb_e458_8826d9f6952e["zod"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe --> 6802ce19_522d_e5fb_e458_8826d9f6952e
  7edb575e_bbe2_1d90_7009_48ce3cf289ac["transform-tw-prefix.ts"]
  7edb575e_bbe2_1d90_7009_48ce3cf289ac --> 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  1eba8e46_a9d0_e6fe_8f31_fe55af5f1855["get-project-info.test.ts"]
  1eba8e46_a9d0_e6fe_8f31_fe55af5f1855 --> 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  13174d4d_522e_6e4c_3c30_407d936dd5c5["get-tailwind-css-file.test.ts"]
  13174d4d_522e_6e4c_3c30_407d936dd5c5 --> 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  2046c1ec_72ff_8afb_4c86_4984b76da349["get-ts-config-alias-prefix.test.ts"]
  2046c1ec_72ff_8afb_4c86_4984b76da349 --> 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  4c7ae382_ec65_ca7d_7abe_2fd54af95159["is-typescript-project.test.ts"]
  4c7ae382_ec65_ca7d_7abe_2fd54af95159 --> 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  style 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from "path"
import { rawConfigSchema } from "@/src/schema"
import { FRAMEWORKS, Framework } from "@/src/utils/frameworks"
import { Config, getConfig, resolveConfigPaths } from "@/src/utils/get-config"
import { getPackageInfo } from "@/src/utils/get-package-info"
import fg from "fast-glob"
import fs from "fs-extra"
import { loadConfig } from "tsconfig-paths"
import { z } from "zod"

export type TailwindVersion = "v3" | "v4" | null

export type ProjectInfo = {
  framework: Framework
  isSrcDir: boolean
  isRSC: boolean
  isTsx: boolean
  tailwindConfigFile: string | null
  tailwindCssFile: string | null
  tailwindVersion: TailwindVersion
  frameworkVersion: string | null
  aliasPrefix: string | null
}

const PROJECT_SHARED_IGNORE = [
  "**/node_modules/**",
  ".next",
  "public",
  "dist",
  "build",
]

const TS_CONFIG_SCHEMA = z.object({
  compilerOptions: z.object({
    paths: z.record(z.string().or(z.array(z.string()))),
  }),
})

export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
  const [
    configFiles,
    isSrcDir,
    isTsx,
    tailwindConfigFile,
    tailwindCssFile,
    tailwindVersion,
    aliasPrefix,
    packageJson,
  ] = await Promise.all([
    fg.glob(
      "**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",
      {
        cwd,
        deep: 3,
        ignore: PROJECT_SHARED_IGNORE,
      }
    ),
    fs.pathExists(path.resolve(cwd, "src")),
    isTypeScriptProject(cwd),
    getTailwindConfigFile(cwd),
// ... (353 more lines)

Subdomains

Dependencies

  • fast-glob
  • frameworks
  • fs-extra
  • get-config
  • get-package-info
  • path
  • schema
  • tsconfig-paths
  • zod

Frequently Asked Questions

What does get-project-info.ts do?
get-project-info.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 get-project-info.ts?
get-project-info.ts defines 10 function(s): getFrameworkVersion, getProjectConfig, getProjectInfo, getProjectTailwindVersionFromConfig, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, getTsConfig, getTsConfigAliasPrefix, isTypeScriptProject.
What does get-project-info.ts depend on?
get-project-info.ts imports 9 module(s): fast-glob, frameworks, fs-extra, get-config, get-package-info, path, schema, tsconfig-paths, and 1 more.
What files import get-project-info.ts?
get-project-info.ts is imported by 5 file(s): get-project-info.test.ts, get-tailwind-css-file.test.ts, get-ts-config-alias-prefix.test.ts, is-typescript-project.test.ts, transform-tw-prefix.ts.
Where is get-project-info.ts in the architecture?
get-project-info.ts is located at packages/shadcn/src/utils/get-project-info.ts (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/src/utils).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free