From 8944cc41e4b9d1569fb8e01bc44a5a2ec7a0062c Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Fri, 27 Jan 2023 12:36:28 +0100 Subject: [PATCH] CLI: only add dependencies on sb init if they do not exist --- code/lib/cli/src/generators/baseGenerator.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/lib/cli/src/generators/baseGenerator.ts b/code/lib/cli/src/generators/baseGenerator.ts index 67cf9d7dec7c..76c6346b341f 100644 --- a/code/lib/cli/src/generators/baseGenerator.ts +++ b/code/lib/cli/src/generators/baseGenerator.ts @@ -270,10 +270,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({