flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
48 lines (44 loc) • 1.35 kB
JavaScript
var fs = require('fs/promises');
var consts = require('../consts.cjs');
async function getConfig() {
const config = {
$schema: "",
components: [],
dark: true,
path: "src/components",
prefix: "",
rsc: true,
tsx: true
};
try {
const raw = await fs.readFile(consts.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;
}
}
exports.getConfig = getConfig;
//# sourceMappingURL=get-config.cjs.map
;