UNPKG

@convo-lang/convo-lang

Version:
23 lines 903 B
import { joinPaths, normalizePath } from "@iyio/common"; import { vfs } from "@iyio/vfs"; export const loadConvoProjectConfigFromVfsAsync = async ({ basePath = '.', filename = 'convo-config.json', maxParentDepth = 255, vfs: vfsCtrl = vfs(), }) => { basePath = normalizePath(basePath); let depth = 0; while (depth < maxParentDepth) { const configPath = joinPaths(basePath, filename); if (await vfsCtrl.getItemAsync(configPath)) { const config = await vfsCtrl.readObjectAsync(configPath); if (config) { config.path = basePath; return config; } } if (!basePath || basePath === '.' || basePath === '/') { break; } basePath = normalizePath(joinPaths(basePath, '..')); depth++; } return undefined; }; //# sourceMappingURL=convo-project-config-lib.js.map