mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Move migrations into separate const
This commit is contained in:
@ -3,24 +3,26 @@ const Store = require("electron-store");
|
|||||||
|
|
||||||
const defaults = require("./defaults");
|
const defaults = require("./defaults");
|
||||||
|
|
||||||
|
const migrations = {
|
||||||
|
">=1.7.0": (store) => {
|
||||||
|
const enabledPlugins = store.get("plugins");
|
||||||
|
if (!Array.isArray(enabledPlugins)) {
|
||||||
|
console.warn("Plugins are not in array format, cannot migrate");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const plugins = {};
|
||||||
|
enabledPlugins.forEach((enabledPlugin) => {
|
||||||
|
plugins[enabledPlugin] = {
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
store.set("plugins", plugins);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = new Store({
|
module.exports = new Store({
|
||||||
defaults,
|
defaults,
|
||||||
clearInvalidConfig: false,
|
clearInvalidConfig: false,
|
||||||
migrations: {
|
migrations,
|
||||||
">=1.7.0": (store) => {
|
|
||||||
const enabledPlugins = store.get("plugins");
|
|
||||||
if (!Array.isArray(enabledPlugins)) {
|
|
||||||
console.warn("Plugins are not in array format, cannot migrate");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const plugins = {};
|
|
||||||
enabledPlugins.forEach((enabledPlugin) => {
|
|
||||||
plugins[enabledPlugin] = {
|
|
||||||
enabled: true,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
store.set("plugins", plugins);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user