(projectRoot)
| 79 | } |
| 80 | |
| 81 | export function loadConfig(projectRoot) { |
| 82 | const possiblePaths = [ |
| 83 | path.resolve(process.cwd(), 'config.json'), |
| 84 | path.join(projectRoot, 'config.json'), |
| 85 | path.join(projectRoot, 'dist', 'config.json'), |
| 86 | path.join(projectRoot, 'src', 'config.json') |
| 87 | ] |
| 88 | |
| 89 | const result = loadJsonFile(possiblePaths, true) |
| 90 | |
| 91 | const missingFields = [] |
| 92 | if (!result.data.sessionPath) missingFields.push('sessionPath') |
| 93 | |
| 94 | if (missingFields.length > 0) { |
| 95 | log('ERROR', 'Invalid config.json - missing required fields:') |
| 96 | missingFields.forEach(field => log('ERROR', ` - ${field}`)) |
| 97 | log('ERROR', `Config file: ${result.path}`) |
| 98 | process.exit(1) |
| 99 | } |
| 100 | |
| 101 | return result |
| 102 | } |
| 103 | |
| 104 | export function loadEnvFile(projectRoot) { |
| 105 | const candidates = [ |
no test coverage detected