Home / Function/ getProjectInfo() — ui Function Reference

getProjectInfo() — ui Function Reference

Architecture documentation for the getProjectInfo() function in get-project-info.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  90d4c1a4_553f_c7f8_7665_87d6136bf243["getProjectInfo()"]
  6a5c3afa_2e3e_bbfc_2351_1976d5a184fe["get-project-info.ts"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|defined in| 6a5c3afa_2e3e_bbfc_2351_1976d5a184fe
  4f6514c5_4180_5c4d_78ff_976a7528790f["getProjectConfig()"]
  4f6514c5_4180_5c4d_78ff_976a7528790f -->|calls| 90d4c1a4_553f_c7f8_7665_87d6136bf243
  b37690ec_c82c_c272_b63f_a755b319db6c["getProjectTailwindVersionFromConfig()"]
  b37690ec_c82c_c272_b63f_a755b319db6c -->|calls| 90d4c1a4_553f_c7f8_7665_87d6136bf243
  9d3f8fb7_b46a_9870_5308_60df44a8f011["isTypeScriptProject()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| 9d3f8fb7_b46a_9870_5308_60df44a8f011
  6b65da51_80a7_9ade_e0bf_3c89e034c6d4["getTailwindConfigFile()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| 6b65da51_80a7_9ade_e0bf_3c89e034c6d4
  fbc853a3_6d9c_5b85_f542_a618e3bc1f17["getTailwindCssFile()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| fbc853a3_6d9c_5b85_f542_a618e3bc1f17
  0b8c335e_22d6_5983_d77e_720ed057e085["getTailwindVersion()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| 0b8c335e_22d6_5983_d77e_720ed057e085
  7a6e72c8_8e76_5361_c11f_5927cb3ab2ff["getTsConfigAliasPrefix()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| 7a6e72c8_8e76_5361_c11f_5927cb3ab2ff
  786fdfd6_87d9_cbb9_0c29_34432bf5fc4f["getFrameworkVersion()"]
  90d4c1a4_553f_c7f8_7665_87d6136bf243 -->|calls| 786fdfd6_87d9_cbb9_0c29_34432bf5fc4f
  style 90d4c1a4_553f_c7f8_7665_87d6136bf243 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/get-project-info.ts lines 39–172

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),
    getTailwindCssFile(cwd),
    getTailwindVersion(cwd),
    getTsConfigAliasPrefix(cwd),
    getPackageInfo(cwd, false),
  ])

  const isUsingAppDir = await fs.pathExists(
    path.resolve(cwd, `${isSrcDir ? "src/" : ""}app`)
  )

  const type: ProjectInfo = {
    framework: FRAMEWORKS["manual"],
    isSrcDir,
    isRSC: false,
    isTsx,
    tailwindConfigFile,
    tailwindCssFile,
    tailwindVersion,
    frameworkVersion: null,
    aliasPrefix,
  }

  // Next.js.
  if (configFiles.find((file) => file.startsWith("next.config."))?.length) {
    type.framework = isUsingAppDir
      ? FRAMEWORKS["next-app"]
      : FRAMEWORKS["next-pages"]
    type.isRSC = isUsingAppDir
    type.frameworkVersion = await getFrameworkVersion(
      type.framework,
      packageJson
    )
    return type
  }

  // Astro.
  if (configFiles.find((file) => file.startsWith("astro.config."))?.length) {
    type.framework = FRAMEWORKS["astro"]
    return type
  }

  // Gatsby.
  if (configFiles.find((file) => file.startsWith("gatsby-config."))?.length) {
    type.framework = FRAMEWORKS["gatsby"]
    return type
  }

  // Laravel.
  if (configFiles.find((file) => file.startsWith("composer.json"))?.length) {
    type.framework = FRAMEWORKS["laravel"]
    return type
  }

  // Remix.
  if (
    Object.keys(packageJson?.dependencies ?? {}).find((dep) =>
      dep.startsWith("@remix-run/")
    )
  ) {

Subdomains

Frequently Asked Questions

What does getProjectInfo() do?
getProjectInfo() is a function in the ui codebase, defined in packages/shadcn/src/utils/get-project-info.ts.
Where is getProjectInfo() defined?
getProjectInfo() is defined in packages/shadcn/src/utils/get-project-info.ts at line 39.
What does getProjectInfo() call?
getProjectInfo() calls 6 function(s): getFrameworkVersion, getTailwindConfigFile, getTailwindCssFile, getTailwindVersion, getTsConfigAliasPrefix, isTypeScriptProject.
What calls getProjectInfo()?
getProjectInfo() is called by 2 function(s): getProjectConfig, getProjectTailwindVersionFromConfig.

Analyze Your Own Codebase

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

Try Supermodel Free