Skip to content

Commit

Permalink
ship it
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Mar 8, 2024
1 parent d0663d6 commit b4e944d
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isCorePackage } from '@storybook/core-common';

type PackageMetadata = {
packageName: string;
beforeVersion: string;
beforeVersion: string | null;
afterVersion: string | null;
};

Expand All @@ -23,7 +23,7 @@ async function getLatestVersions(
return Promise.all(
packages.map(async ([packageName, beforeVersion]) => ({
packageName,
beforeVersion,
beforeVersion: coerce(beforeVersion)?.toString() || null,
afterVersion: await packageManager.latestVersion(packageName).catch(() => null),
}))
);
Expand Down Expand Up @@ -74,13 +74,18 @@ export const upgradeStorybookRelatedDependencies = {
).map((packageName) => [packageName, allDependencies[packageName]]) as [string, string][];

const packageVersions = await getLatestVersions(packageManager, uniquePackages);
const upgradablePackages = packageVersions.filter(({ packageName, afterVersion }) => {
if (afterVersion === null) {
return false;
}
const upgradablePackages = packageVersions.filter(
({ packageName, afterVersion, beforeVersion }) => {
if (beforeVersion === null) {
return false;
}
if (afterVersion === null) {
return false;
}

return isPackageUpgradable(afterVersion, packageName, allDependencies);
});
return isPackageUpgradable(afterVersion, packageName, allDependencies);
}
);

return upgradablePackages.length > 0 ? { upgradable: upgradablePackages } : null;
},
Expand Down

0 comments on commit b4e944d

Please sign in to comment.