(rcPath: string)
| 300 | } |
| 301 | |
| 302 | function loadRcFile(rcPath: string): IRcFileConfig { |
| 303 | try { |
| 304 | const content = readFileSync(rcPath, 'utf8'); |
| 305 | const config = JSON.parse(content); |
| 306 | |
| 307 | // Interpolate npm package variables before validation |
| 308 | const interpolatedConfig = interpolateNpmVariables(config, rcPath); |
| 309 | |
| 310 | return validateRcConfig(interpolatedConfig, rcPath); |
| 311 | } catch (error) { |
| 312 | if (error instanceof SyntaxError) |
| 313 | throw new Error(`Invalid JSON in RC file ${rcPath}: ${error.message}`, { cause: error }); |
| 314 | |
| 315 | throw error; |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | export function loadRcFileConfig(configPath?: string): Partial<IRcFileConfig> { |
| 320 | const rcPath = findRcFile(configPath); |
no test coverage detected