36 lines
726 B
TypeScript
36 lines
726 B
TypeScript
import { loadConfig, ConfigError } from "../src/lib/config/load";
|
|||
|
|
|
||
|
|
const configPathArg = process.argv[2];
|
||
|
|
|
||
|
|
try {
|
||
|
|
const { config, configPath } = loadConfig(configPathArg);
|
||
|
|
console.log(
|
||
|
|
JSON.stringify({
|
||
|
|
ok: true,
|
||
|
|
configPath,
|
||
|
|
scriptCount: config.scripts.length,
|
||
|
|
authEnabled: config.auth.enabled,
|
||
|
|
}),
|
||
|
|
);
|
||
|
|
process.exit(0);
|
||
|
|
} catch (error) {
|
||
|
|
if (error instanceof ConfigError) {
|
||
|
|
console.log(
|
||
|
|
JSON.stringify({
|
||
|
|
ok: false,
|
||
|
|
message: error.message,
|
||
|
|
issues: error.issues,
|
||
|
|
}),
|
||
|
|
);
|
||
|
|
} else {
|
||
|
|
console.log(
|
||
|
|
JSON.stringify({
|
||
|
|
ok: false,
|
||
|
|
message: (error as Error).message,
|
||
|
|
issues: [],
|
||
|
|
}),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
process.exit(1);
|
||
|
|
}
|