UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

46 lines (43 loc) 1.34 kB
import fs__default from 'fs/promises'; import { configFilePath } from '../consts.js'; async function getConfig() { const config = { $schema: "", components: [], dark: true, path: "src/components", prefix: "", rsc: true, tsx: true }; try { const raw = await fs__default.readFile(configFilePath, "utf-8"); const parsed = JSON.parse(raw); if (parsed.$schema !== void 0 && typeof parsed.$schema === "string") { config.$schema = parsed.$schema; } if (parsed.components !== void 0 && Array.isArray(parsed.components)) { config.components = parsed.components.map((component) => component.trim()).filter(Boolean); } if (parsed.dark !== void 0 && typeof parsed.dark === "boolean") { config.dark = parsed.dark; } if (parsed.path !== void 0 && typeof parsed.path === "string") { config.path = parsed.path; } if (parsed.prefix !== void 0 && typeof parsed.prefix === "string") { config.prefix = parsed.prefix; } if (parsed.rsc !== void 0 && typeof parsed.rsc === "boolean") { config.rsc = parsed.rsc; } if (parsed.tsx !== void 0 && typeof parsed.tsx === "boolean") { config.tsx = parsed.tsx; } return config; } catch { return config; } } export { getConfig }; //# sourceMappingURL=get-config.js.map