Skip to content

Commit

Permalink
CLI: Fix add command not respecting --yes flag when addon is already …
Browse files Browse the repository at this point in the history
…installed
  • Loading branch information
yannbf committed Jan 6, 2025
1 parent 19f82a0 commit c826b86
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions code/lib/cli-storybook/src/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,19 @@ export async function add(

let shouldAddToMain = true;
if (checkInstalled(addonName, requireMain(configDir))) {
const { shouldForceInstall } = await prompts({
type: 'confirm',
name: 'shouldForceInstall',
message: `The Storybook addon "${addonName}" is already present in ${mainConfig}. Do you wish to install it again?`,
});

if (!shouldForceInstall) {
return;
}

shouldAddToMain = false;
if (!yes) {
logger.log(`The Storybook addon "${addonName}" is already present in ${mainConfig}.`);
const { shouldForceInstall } = await prompts({
type: 'confirm',
name: 'shouldForceInstall',
message: `Do you wish to install it again?`,
});

if (!shouldForceInstall) {
return;
}
}
}

const main = await readConfig(mainConfig);
Expand Down

0 comments on commit c826b86

Please sign in to comment.