UNPKG

@alauda/doom

Version:

Doctor Doom making docs.

21 lines (20 loc) 654 B
import fs from 'node:fs/promises'; import { loadConfig } from "../cli/load-config.js"; import { OPTIONS_FILE } from "../utils/index.js"; export const PUNCTUATION_REGEX = /\p{P}/u; let config; let configFilePath; export async function getConfig() { if (!config || !configFilePath) { let optionsText; try { optionsText = await fs.readFile(OPTIONS_FILE, 'utf8'); } catch { // } const { root, globalOptions } = (optionsText ? JSON.parse(optionsText) : {}); ({ config, configFilePath } = await loadConfig(root, globalOptions)); } return { config, configFilePath }; }