Open stevensacks opened 1 month ago
Disclaimer This information might be inaccurate, due to it being generated automatically
To resolve the issue of unpinned dependencies during the upgrade, modify the doUpgrade
function in upgrade.ts
to respect the existing version format in package.json
. Specifically, update the toUpgradedDependencies
function to check if the current version is pinned and maintain that format. Here are the steps:
upgrade.ts
, locate the toUpgradedDependencies
function.const toUpgradedDependencies = (deps: Record<string, any>) => {
const monorepoDependencies = Object.keys(deps || {}).filter((dependency) => {
return dependency in versions;
}) as Array<keyof typeof versions>;
return monorepoDependencies.map((dependency) => {
const currentVersion = deps[dependency];
const isPinned = !currentVersion.startsWith('^');
const newVersion = versions[dependency];
return `${dependency}@${isPinned ? '' : '^'}${newVersion}`;
});
};
upgrade.test.ts
to include scenarios with pinned dependencies and verify that the upgrade maintains the pinned format./code/lib/cli/src/upgrade.ts /code/lib/cli/src/upgrade.test.ts
Describe the bug
If you have pinned dependencies in
package.json
When
npx sb@latest upgrade
is run, the dependencies should remain pinned.But it currently adds a
^
caret before the version:Reproduction link
https://storybook.js.org/docs/configure/upgrading
Reproduction steps
npx sb@latest upgrade
System
Additional context
No response