mdxlayer
Version:
Transform your MDX content into typed, JSON-powered data with flexible schema validation.
27 lines (24 loc) • 714 B
JavaScript
import fs from 'node:fs';
import path from 'node:path';
import { cliConfigFile } from '../utils/args.js';
const CONFIG_FILENAMES = [
"mdxlayer.config.ts",
"mdxlayer.config.js",
"mdxlayer.config.mjs",
"mdxlayer.config.cjs",
"mdxlayer.config.mts",
"mdxlayer.config.cts"
];
const configPath = (() => {
const cwd = process.cwd();
if (cliConfigFile) {
const fullPath = path.resolve(cwd, cliConfigFile);
if (fs.existsSync(cliConfigFile)) return fullPath;
}
for (const filename of CONFIG_FILENAMES) {
const fullPath = path.resolve(cwd, filename);
if (fs.existsSync(fullPath)) return fullPath;
}
throw new Error("❌ No mdxlayer config file found.");
})();
export { configPath };