Skip to content

Commit

Permalink
fix the logic adding the caret to upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Feb 15, 2024
1 parent 4664dc1 commit f24784d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions code/lib/cli/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,16 @@ export const doUpgrade = async ({
return dependency in versions;
}) as Array<keyof typeof versions>;
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]}`;
});
};

Expand Down

0 comments on commit f24784d

Please sign in to comment.