mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
fix(migration): handle already-v5 settings and ensure 'failed' branch writes v5 marker
This commit is contained in:
@@ -25,6 +25,10 @@ class MigrationRunner {
|
||||
return 'migrated';
|
||||
} catch (err) {
|
||||
console.error('[migration-runner] transform failed:', err.message);
|
||||
// Back up the original and write v5 marker so future launches skip migration.
|
||||
// Without this, every launch would fail again and the user stays on defaults.
|
||||
fs.copyFileSync(this.file, this.backup);
|
||||
fs.writeFileSync(this.file, JSON.stringify({ ...raw, 'migration.version': 5 }, null, 2));
|
||||
return 'failed';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user