UNPKG

@withstudiocms/config-utils

Version:

Utilities for managing configuration files

22 lines (21 loc) 408 B
import { statSync } from "node:fs"; function exists(path) { if (!path) return false; try { statSync(path); return true; } catch { return false; } } function findConfig(projectRootUrl, configPaths) { for (const path of configPaths) { const configUrl = `${projectRootUrl}${path}`; if (exists(configUrl)) return configUrl; } return void 0; } export { exists, findConfig };