diff --git a/.changeset/slimy-rivers-think.md b/.changeset/slimy-rivers-think.md new file mode 100644 index 000000000..06625d9b6 --- /dev/null +++ b/.changeset/slimy-rivers-think.md @@ -0,0 +1,5 @@ +--- +'sv': patch +--- + +fix: always add `storybook` after all other add-ons diff --git a/packages/cli/lib/install.ts b/packages/cli/lib/install.ts index 03932917c..9c0bfb7e8 100644 --- a/packages/cli/lib/install.ts +++ b/packages/cli/lib/install.ts @@ -182,9 +182,12 @@ async function runAddon({ addon, multiple, workspace }: RunAddon) { // orders addons by putting addons that don't require any other addon in the front. // This is a drastic simplification, as this could still cause some inconvenient cituations, -// but works for now in contrary to the previouse implementation +// but works for now in contrary to the previous implementation function orderAddons(addons: Array>, setupResults: Record) { - return addons.sort( - (a, b) => setupResults[a.id]?.dependsOn?.length - setupResults[b.id]?.dependsOn?.length - ); + return addons.sort((a, b) => { + // Adding storybook last means it will correctly detect and integrate with other addons like vitest and eslint + if (a.id === 'storybook') return 1; + if (b.id === 'storybook') return -1; + return setupResults[a.id]?.dependsOn?.length - setupResults[b.id]?.dependsOn?.length; + }); }