cli: include version info and upgrade helper link in bump output

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-02-10 15:49:14 +01:00
parent 6471765816
commit d32504ccca
2 changed files with 25 additions and 10 deletions
@@ -273,7 +273,7 @@ describe('bump', () => {
'unlocking @backstage/core-api@^1.0.6 ~> 1.0.7',
'unlocking @backstage/core-api@^1.0.3 ~> 1.0.7',
'bumping @backstage/theme in b to ^5.0.0',
'Creating backstage.json',
'Your project is now at version 0.0.1, which has been written to backstage.json',
'Running yarn install to install new versions',
'⚠️ The following packages may have breaking changes:',
' @backstage/theme : 1.0.0 ~> 5.0.0',
@@ -389,7 +389,7 @@ describe('bump', () => {
'Some packages are outdated, updating',
'bumping @backstage/core in a to ^5.0.0',
'bumping @backstage/core in b to ^5.0.0',
'Creating backstage.json',
'Your project is now at version 2.0.0, which has been written to backstage.json',
'Running yarn install to install new versions',
'⚠️ The following packages may have breaking changes:',
' @backstage/core : 1.0.3 ~> 5.0.0',
+23 -8
View File
@@ -420,17 +420,32 @@ export async function bumpBackstageJsonVersion(version: string) {
throw e;
});
if (backstageJson?.version === version) {
const prevVersion = backstageJson?.version;
if (prevVersion === version) {
return;
}
console.log(
chalk.yellow(
typeof backstageJson === 'undefined'
? `Creating ${BACKSTAGE_JSON}`
: `Bumping version in ${BACKSTAGE_JSON}`,
),
);
const { yellow, cyan, green } = chalk;
if (prevVersion) {
const link = `https://backstage.github.io/upgrade-helper/?from=${prevVersion}&to=${version}`;
console.log(
yellow(
`Upgraded from release ${green(prevVersion)} to ${green(
version,
)}, please review the app changes:`,
),
);
console.log();
console.log(` ${cyan(link)}`);
console.log();
} else {
console.log(
yellow(
`Your project is now at version ${version}, which has been written to ${BACKSTAGE_JSON}`,
),
);
}
await fs.writeJson(
backstageJsonPath,