Skip to content

Commit

Permalink
Settings API: Add utility to migrate a setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jan 27, 2025
1 parent ea1e961 commit d6141cd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/api/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ export function migratePluginSettings(name: string, ...oldNames: string[]) {
}
}

export function migratePluginSetting(pluginName: string, oldSetting: string, newSetting: string) {
const { plugins } = SettingsStore.plain;

plugins[pluginName][newSetting] = plugins[pluginName][oldSetting];
delete plugins[pluginName][oldSetting];
SettingsStore.markAsChanged();
}

export function definePluginSettings<
Def extends SettingsDefinition,
Checks extends SettingsChecks<Def>,
Expand Down

0 comments on commit d6141cd

Please sign in to comment.