feat: rework default plugins and keep unchosen plugins off in the first run picker

This commit is contained in:
LukeGus committed 2026-11-03 21:29:39 -06:00
1 parent 31df4b12e3
commit b9df36b09a
7 files changed
+74 -23

No files matched your search

+5 -4
View File
@@ -10,8 +10,9 @@ export function currentChoice(plugin: OnboardingPluginInfo): PluginChoice {
/**
* What the picker starts on. On a fresh install recommended plugins are on
* and the rest are set to be removed; consent ones start on. Later runs
* start from how things are now.
* and the rest stay installed but off, so a full image keeps every plugin
* unless the admin picks Remove; consent ones start on. Later runs start from
* how things are now.
*/
export function defaultChoices(
list: OnboardingPluginList,
@@ -26,7 +27,7 @@ export function defaultChoices(
return [plugin.id, currentChoice(plugin)];
}
if (plugin.consent) return [plugin.id, "enabled"];
return [plugin.id, plugin.recommended ? "enabled" : "remove"];
return [plugin.id, plugin.recommended ? "enabled" : "disabled"];
}),
);
}
@@ -37,7 +38,7 @@ export function recommendedChoices(
return Object.fromEntries(
list.plugins.map((plugin) => [
plugin.id,
plugin.recommended || plugin.consent ? "enabled" : "remove",
plugin.recommended || plugin.consent ? "enabled" : "disabled",
]),
);
}
@@ -49,11 +49,11 @@ const LIST: OnboardingPluginList = {
};
describe("defaultChoices", () => {
it("keeps recommended plugins and removes the rest on a fresh install", () => {
it("keeps recommended plugins on and the rest off on a fresh install", () => {
expect(defaultChoices(LIST)).toEqual({
term: "enabled",
base: "remove",
addon: "remove",
base: "disabled",
addon: "disabled",
stats: "enabled",
});
});
@@ -139,8 +139,8 @@ describe("PluginsStep", () => {
resolved: {},
adjustments: [],
enabled: [],
disabled: [],
removed: ["base", "addon"],
disabled: ["base", "addon"],
removed: [],
failed: [],
});
api.getOnboardingPlugins.mockResolvedValueOnce(LIST).mockResolvedValue({
@@ -155,8 +155,8 @@ describe("PluginsStep", () => {
expect(ok).toBe(true);
expect(api.applyOnboardingPlugins).toHaveBeenCalledWith({
term: "enabled",
base: "remove",
addon: "remove",
base: "disabled",
addon: "disabled",
stats: "enabled",
});
expect(loader.syncPlugins).toHaveBeenCalled();