Skip to content

Commit

Permalink
Sandbox: Avoid redundant extra dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Sep 10, 2024
1 parent 5d4791c commit 8eb7695
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,24 @@ export const sandbox: Task = {
await addStories(details, options);
}

const extraDeps = [
const extraDeps = new Set([
...(details.template.modifications?.extraDependencies ?? []),
// The storybook package forwards some CLI commands to @storybook/cli with npx.
// Adding the dep makes sure that even npx will use the linked workspace version.
'@storybook/cli',
];
]);
if (!details.template.skipTasks?.includes('vitest-integration')) {
extraDeps.push(
[
'happy-dom',
'vitest',
'playwright',
'@vitest/browser',
'@storybook/experimental-addon-test'
);
'@storybook/experimental-addon-test',
].forEach((dep) => extraDeps.add(dep));

if (details.template.expected.framework.includes('nextjs')) {
extraDeps.push('@storybook/experimental-nextjs-vite', 'jsdom');
extraDeps.add('@storybook/experimental-nextjs-vite');
extraDeps.add('jsdom');
}

// if (details.template.expected.renderer === '@storybook/svelte') {
Expand All @@ -116,7 +117,7 @@ export const sandbox: Task = {
cwd: details.sandboxDir,
debug: options.debug,
dryRun: options.dryRun,
extraDeps,
extraDeps: Array.from(extraDeps),
});

await extendMain(details, options);
Expand Down

0 comments on commit 8eb7695

Please sign in to comment.