cli: conditionally include yarnPlugin query param in versions:bump upgrade-helper link

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-10-18 15:27:54 +01:00
parent 42c2c95f5b
commit 17850a5809
2 changed files with 19 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Update upgrade-helper link in versions:bump command to include yarnPlugin param when the yarn plugin is installed
+14 -3
View File
@@ -228,7 +228,10 @@ export default async (opts: OptionValues) => {
// Do not update backstage.json when upgrade patterns are used.
if (pattern === DEFAULT_PATTERN_GLOB) {
await bumpBackstageJsonVersion(releaseManifest.releaseVersion);
await bumpBackstageJsonVersion(
releaseManifest.releaseVersion,
hasYarnPlugin,
);
} else {
console.log(
chalk.yellow(
@@ -410,7 +413,10 @@ async function getBackstageJson() {
});
}
export async function bumpBackstageJsonVersion(version: string) {
export async function bumpBackstageJsonVersion(
version: string,
useYarnPlugin?: boolean,
) {
const backstageJson = await getBackstageJson();
const prevVersion = backstageJson?.version;
@@ -422,7 +428,12 @@ export async function bumpBackstageJsonVersion(version: string) {
if (prevVersion) {
const from = encodeURIComponent(prevVersion);
const to = encodeURIComponent(version);
const link = `https://backstage.github.io/upgrade-helper/?from=${from}&to=${to}`;
let link = `https://backstage.github.io/upgrade-helper/?from=${from}&to=${to}`;
if (useYarnPlugin) {
link += '&yarnPlugin=1';
}
console.log(
yellow(
`Upgraded from release ${green(prevVersion)} to ${green(