Fix not filtering .json files for config

This commit is contained in:
ajnart
2023-01-08 13:09:54 +09:00
parent c2a9ff44fd
commit 6f6888f6a7
4 changed files with 13 additions and 6 deletions

View File

@@ -6,6 +6,10 @@ import { migrateConfig } from './migrateConfig';
export function backendMigrateConfig(config: Config, name: string): ConfigType {
const migratedConfig = migrateConfig(config);
// Make a backup of the old file ./data/configs/${name}.json
// New name is ./data/configs/${name}.bak
fs.copyFileSync(`./data/configs/${name}.json`, `./data/configs/${name}.json.bak`);
// Overrite the file ./data/configs/${name}.json
// with the new config format
fs.writeFileSync(`./data/configs/${name}.json`, JSON.stringify(migratedConfig, null, 2));