UNPKG

@acurast/cli

Version:

A cli to interact with the Acurast Cloud.

25 lines 964 B
import fs from 'fs'; export const loadConfig = (project) => { const filePath = './acurast.json'; const fileExists = fs.existsSync(filePath); if (!fileExists) { throw new Error(`acurast.json not found! Run "acurast init" first`); } const fileContent = fs.readFileSync(filePath, 'utf-8'); const config = JSON.parse(fileContent); if (!project) { const projects = Object.keys(config.projects); if (projects.length === 1) { return config.projects[projects[0]]; } if (projects.length === 0) { throw new Error(`No projects found in acurast.json. Run "acurast init" first`); } throw new Error(`Project not specified. Available projects: ${projects.join(', ')}`); } if (config.projects[project]) { return config.projects[project]; } throw new Error(`Project "${project}" not found in acurast.json`); }; //# sourceMappingURL=loadConfig.js.map