Add better logging and fix command index

Signed-off-by: Zack Griesinger <zack.griesinger@c2fo.com>
This commit is contained in:
Zack Griesinger
2021-12-27 15:54:10 -06:00
parent 93d8a6f0bb
commit bafc399585
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -214,7 +214,7 @@ export function registerCommands(program: CommanderStatic) {
program
.command('versions:bump')
.option('--prefix', 'Override glob for matching packages to upgrade')
.option('--prefix <glob>', 'Override glob for matching packages to upgrade')
.description('Bump Backstage packages to the latest versions')
.action(lazy(() => import('./versions/bump').then(m => m.default)));
@@ -129,6 +129,7 @@ describe('bump', () => {
await bump({ prefix: null } as Command);
});
expect(logs.filter(Boolean)).toEqual([
'Using default prefix glob @backstage/*',
'Checking for updates of @backstage/theme',
'Checking for updates of @backstage/core',
'Checking for updates of @backstage/core-api',
@@ -254,6 +255,7 @@ describe('bump', () => {
await bump({ prefix: '@{backstage,backstage-extra}/*' } as any);
});
expect(logs.filter(Boolean)).toEqual([
'Using custom prefix glob @{backstage,backstage-extra}/*',
'Checking for updates of @backstage/theme',
'Checking for updates of @backstage-extra/custom-two',
'Checking for updates of @backstage-extra/custom',
@@ -350,6 +352,7 @@ describe('bump', () => {
await bump({ prefix: null } as any);
});
expect(logs.filter(Boolean)).toEqual([
'Using default prefix glob @backstage/*',
'Checking for updates of @backstage/theme',
'Checking for updates of @backstage/core',
'Package info not found, ignoring package @backstage/theme',
+6 -1
View File
@@ -38,6 +38,8 @@ const DEP_TYPES = [
'optionalDependencies',
];
const DEFAULT_PREFIX_GLOB = '@backstage/*';
type PkgVersionInfo = {
range: string;
target: string;
@@ -51,7 +53,10 @@ export default async (cmd: Command) => {
let prefix = cmd.prefix;
if (!prefix) {
prefix = '@backstage/*';
console.log(`Using default prefix glob ${DEFAULT_PREFIX_GLOB}`);
prefix = DEFAULT_PREFIX_GLOB;
} else {
console.log(`Using custom prefix glob ${prefix}`);
}
const findTargetVersion = createVersionFinder();