Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-rivers-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: always add `storybook` after all other add-ons
11 changes: 7 additions & 4 deletions packages/cli/lib/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Addon<any>>, setupResults: Record<string, AddonSetupResult>) {
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;
});
}