MCPcopy Create free account
hub / github.com/BCsabaEngine/svelteesp32 / loadRcFile

Function loadRcFile

src/commandLine.ts:302–317  ·  view source on GitHub ↗
(rcPath: string)

Source from the content-addressed store, hash-verified

300}
301
302function 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
319export function loadRcFileConfig(configPath?: string): Partial<IRcFileConfig> {
320 const rcPath = findRcFile(configPath);

Callers 2

loadRcFileConfigFunction · 0.85
parseArgumentsFunction · 0.85

Calls 2

interpolateNpmVariablesFunction · 0.85
validateRcConfigFunction · 0.85

Tested by

no test coverage detected