Skip to content

Commit

Permalink
Merge pull request #20811 from storybookjs/fix/init-when-no-deps-are-…
Browse files Browse the repository at this point in the history
…needed

CLI: only add dependencies on sb init if they do not exist
  • Loading branch information
ndelangen authored Jan 30, 2023
2 parents 7066b42 + 8944cc4 commit dbe8f12
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/lib/cli/src/generators/baseGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ export async function baseGenerator(
if (isNewFolder) {
await generateStorybookBabelConfigInCWD();
}
packageManager.addDependencies({ ...npmOptions, packageJson }, [
...versionedPackages,
...babelDependencies,
]);

const depsToInstall = [...versionedPackages, ...babelDependencies];

if (depsToInstall.length > 0) {
packageManager.addDependencies({ ...npmOptions, packageJson }, depsToInstall);
}

if (addScripts) {
packageManager.addStorybookCommandInScripts({
Expand Down

0 comments on commit dbe8f12

Please sign in to comment.