Rename migrateSettingsToV2 to migrateV1ToLatest

This commit is contained in:
Alexander Farber 2026-01-21 11:43:20 +01:00 committed by Mingholy
parent 895cbf71cd
commit 273caf1cde

View file

@ -288,7 +288,12 @@ export function needsMigration(settings: Record<string, unknown>): boolean {
return hasV1Keys || hasInvertedBooleanKeys;
}
function migrateSettingsToV2(
/**
* Migrates V1 (flat) settings directly to the latest version (V3).
* This includes both structural migration (flat -> nested) and boolean
* inversion (disable* -> enable*), so migrateV2ToV3 will be skipped.
*/
function migrateV1ToLatest(
flatSettings: Record<string, unknown>,
): Record<string, unknown> | null {
if (!needsMigration(flatSettings)) {
@ -943,7 +948,7 @@ export function loadSettings(
let settingsObject = rawSettings as Record<string, unknown>;
if (needsMigration(settingsObject)) {
const migratedSettings = migrateSettingsToV2(settingsObject);
const migratedSettings = migrateV1ToLatest(settingsObject);
if (migratedSettings) {
if (MIGRATE_V2_OVERWRITE) {
try {