UNPKG

@mdn/bob

Version:

Builder of Bits aka The MDN Web Docs interactive examples, example builder

29 lines 923 B
import { cosmiconfigSync } from "cosmiconfig"; import path from "node:path"; import { fileURLToPath } from "node:url"; const __dirname = fileURLToPath(new URL(".", import.meta.url)); const CONFIG_FILE_PATH = "../.bobconfigrc"; function getConfig() { const configFile = path.join(__dirname, CONFIG_FILE_PATH); const cosmiConfig = cosmiconfigSync("bobconfig", { cache: false, }); const configResult = cosmiConfig.load(configFile); if (!configResult) { throw new TypeError(`MDN-BOB: Failed to load "${CONFIG_FILE_PATH}"`); } const config = configResult.config; const processArguments = getProcessArguments(); return { ...config, ...processArguments, }; } function getProcessArguments() { const argv = process.argv; return { doWebPack: !argv.includes("--skip-webpack"), }; } export default getConfig; //# sourceMappingURL=config.js.map