fix: compile_config.js should skip when YAML file not found instead of failing

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-03 12:06:36 +00:00
parent 010b540679
commit 85e9612506

View File

@ -27,18 +27,17 @@ const OUTPUT_PATH = resolve(configDir, '.config.json');
*/
function yamlToJson(ymlPath) {
if (!fs.existsSync(ymlPath)) {
console.warn(`YAML file not found: ${ymlPath}`);
process.exit(1);
console.log(`skipped: ${ymlPath} is not found`);
return;
}
console.log(`${ymlPath}${OUTPUT_PATH}`);
const yamlContent = fs.readFileSync(ymlPath, 'utf-8');
const jsonContent = yaml.load(yamlContent);
fs.writeFileSync(OUTPUT_PATH, JSON.stringify({
'_NOTE_': 'This file is auto-generated from YAML file. DO NOT EDIT.',
...jsonContent,
}), 'utf-8');
console.log(`${ymlPath}${OUTPUT_PATH}`);
}
if (process.env.MISSKEY_CONFIG_YML) {
@ -48,4 +47,4 @@ if (process.env.MISSKEY_CONFIG_YML) {
yamlToJson(resolve(configDir, process.env.NODE_ENV === 'test' ? 'test.yml' : 'default.yml'));
}
console.log('Configuration compiled');
console.log('Configuration compiled');