Files
shadcn-ui/packages/shadcn/src/utils/env-loader.ts
shadcn 07eda36b13 feat(shadcn): add namespaced registries support (#7919)
* chore(shadcn): implement registries poc

* feat(shadcn): refactor our initial implementation

* feat(shadcn): properly resolve namespaced registryDependencies

* feat(shadcn): resolve namespaced registries recursively

* fix

* feat(shadcn): implement dotenv support

* test(shadcn): mock shadcn registry

* fix

* fix

* fix

* refactor(shadcn): update functions and tests

* refactor(shadcn): add fetchFromRegistry (#7937)

* fix

* feat(shadcn): add shadcn as a built-in registry

* fix

* feat(shadcn): update no framework and shadcn
2025-08-04 14:35:41 +04:00

29 lines
679 B
TypeScript

import { existsSync } from "fs"
import { join } from "path"
import { logger } from "@/src/utils/logger"
export async function loadEnvFiles(cwd: string = process.cwd()): Promise<void> {
try {
const { config } = await import("@dotenvx/dotenvx")
const envFiles = [
".env.local",
".env.development.local",
".env.development",
".env",
]
for (const envFile of envFiles) {
const envPath = join(cwd, envFile)
if (existsSync(envPath)) {
config({
path: envPath,
overload: false,
quiet: true,
})
}
}
} catch (error) {
logger.warn("Failed to load env files:", error)
}
}