backstage-cli: only use backstage:^ version if the package exists in the new manifest

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-07-27 14:48:31 +01:00
parent 3d88455be9
commit 1e4b91f6d7
+10 -3
View File
@@ -195,10 +195,17 @@ export default async (opts: OptionValues) => {
// versions, we need to perform the same transformation.
const oldLockfileRange = await asLockfileVersion(oldRange);
// Don't use backstage:^ versions for peerDependencies; they only
// support npm and workspace: versions.
const useBackstageRange =
hasYarnPlugin && depType !== 'peerDependencies';
hasYarnPlugin &&
// Only use backstage:^ versions if the package is present in
// the manifest for the release we're bumping to.
releaseManifest.packages.find(
({ name: manifestPackageName }) =>
dep.name === manifestPackageName,
) &&
// Don't use backstage:^ versions for peerDependencies; they only
// support npm and workspace: versions.
depType !== 'peerDependencies';
const newRange = useBackstageRange ? 'backstage:^' : dep.range;