cli: migrate info command to module

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-03-03 20:12:55 +01:00
parent 563a7a5340
commit d0fc357c37
7 changed files with 72 additions and 11 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Internal update to move `info` commands to a separate module.
+1 -1
View File
@@ -23,8 +23,8 @@ Commands:
versions:migrate [options]
migrate [command]
build-workspace [options] <workspace-dir> [packages...]
create-github-app <github-org>
info
create-github-app <github-org>
help [command]
```
+1
View File
@@ -24,6 +24,7 @@ import chalk from 'chalk';
),
);
const initializer = new CliInitializer();
initializer.add(import('./modules/info/alpha'));
initializer.add(import('./modules/config/alpha'));
initializer.add(import('./modules/build/alpha'));
initializer.add(import('./modules/migrate/alpha'));
+2 -5
View File
@@ -25,6 +25,7 @@ import {
registerRepoCommands as registerRepoBuildCommands,
registerCommands as registerBuildCommands,
} from '../modules/build';
import { registerCommands as registerInfoCommands } from '../modules/info';
import { registerCommands as registerMigrateCommand } from '../modules/migrate';
export function registerRepoCommand(program: Command) {
@@ -214,17 +215,13 @@ export function registerCommands(program: Command) {
registerScriptCommand(program);
registerMigrateCommand(program);
registerBuildCommands(program);
registerInfoCommands(program);
program
.command('create-github-app <github-org>')
.description('Create new GitHub App in your organization.')
.action(lazy(() => import('./create-github-app'), 'default'));
program
.command('info')
.description('Show helpful information for debugging and reporting bugs')
.action(lazy(() => import('./info'), 'default'));
// Notifications for removed commands
program
.command('create')
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright 2024 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import yargs from 'yargs';
import { createCliPlugin } from '../../wiring/factory';
export default createCliPlugin({
pluginId: 'info',
init: async reg => {
reg.addCommand({
path: ['info'],
description: 'Show helpful information for debugging and reporting bugs',
execute: async ({ args }) => {
yargs().parse(args);
const { default: command } =
require('./commands/info') as typeof import('./commands/info');
await command();
},
});
},
});
@@ -1,5 +1,5 @@
/*
* Copyright 2020 The Backstage Authors
* Copyright 2025 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,11 +14,11 @@
* limitations under the License.
*/
import { version as cliVersion } from '../../package.json';
import { version as cliVersion } from '../../../../package.json';
import os from 'os';
import { runPlain } from '../lib/run';
import { paths } from '../lib/paths';
import { Lockfile } from '../lib/versioning';
import { runPlain } from '../../../lib/run';
import { paths } from '../../../lib/paths';
import { Lockfile } from '../../../lib/versioning';
import fs from 'fs-extra';
export default async () => {
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { lazy } from '../../lib/lazy';
import { Command } from 'commander';
export function registerCommands(program: Command) {
program
.command('info')
.description('Show helpful information for debugging and reporting bugs')
.action(lazy(() => import('./commands/info'), 'default'));
}