From f24784d9cd0b3b349b3e9030eb08a61b651e0967 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 15 Feb 2024 17:14:02 +0100 Subject: [PATCH] fix the logic adding the caret to upgrade --- code/lib/cli/src/upgrade.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/lib/cli/src/upgrade.ts b/code/lib/cli/src/upgrade.ts index e9f4a8151b1c..7f704a0542d7 100644 --- a/code/lib/cli/src/upgrade.ts +++ b/code/lib/cli/src/upgrade.ts @@ -238,10 +238,16 @@ export const doUpgrade = async ({ return dependency in versions; }) as Array; return monorepoDependencies.map((dependency) => { + let char = '^'; + if (isOutdated) { + char = ''; + } + if (isCanary) { + char = ''; + } /* add ^ modifier to the version if this is the latest stable or prerelease version example outputs: @storybook/react@^8.0.0 */ - const maybeCaret = (!isOutdated || isPrerelease) && !isCanary ? '^' : ''; - return `${dependency}@${maybeCaret}${versions[dependency]}`; + return `${dependency}@${char}${versions[dependency]}`; }); };