move create-github-app to its own module

Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
aramissennyeydd
2025-04-05 16:11:10 -04:00
parent fa5041aa6e
commit 2d66d0dc0f
8 changed files with 70 additions and 21 deletions
+1
View File
@@ -26,6 +26,7 @@ import chalk from 'chalk';
);
const initializer = new CliInitializer();
initializer.add(import('./modules/new/alpha'));
initializer.add(import('./modules/create-github-app/alpha'));
initializer.add(import('./modules/info/alpha'));
initializer.add(import('./modules/config/alpha'));
initializer.add(import('./modules/build/alpha'));
+2 -1
View File
@@ -42,6 +42,7 @@ import {
} from '../modules/maintenance';
import { removed } from '../lib/removed';
import { registerCommands as registerNewCommands } from '../modules/new';
import { registerCommands as registerCreateGithubAppCommands } from '../modules/create-github-app';
export function registerRepoCommand(program: Command) {
const command = program
@@ -75,7 +76,7 @@ export function registerCommands(program: Command) {
registerBuildCommands(program);
registerInfoCommands(program);
registerNewCommands(program);
registerCreateGithubAppCommands(program);
// Notifications for removed commands
program
@@ -0,0 +1,38 @@
/*
* 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.
* 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 { createCliPlugin } from '../../wiring/factory';
import { Command } from 'commander';
import { lazy } from '../../lib/lazy';
export default createCliPlugin({
pluginId: 'new',
init: async reg => {
reg.addCommand({
path: ['create-github-app'],
description: 'Create new GitHub App in your organization.',
execute: async ({ args }) => {
const command = new Command();
const defaultCommand = command
.argument('<github-org>')
.action(
lazy(() => import('./commands/create-github-app'), 'default'),
);
await defaultCommand.parseAsync(args, { from: 'user' });
},
});
},
});
@@ -0,0 +1,29 @@
/*
* 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.
* 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 { Command } from 'commander';
import { lazy } from '../../lib/lazy';
export function registerCommands(program: Command) {
program
.command('create-github-app <github-org>')
.description('Create new GitHub App in your organization.')
.action(
lazy(
() => import('../create-github-app/commands/create-github-app'),
'default',
),
);
}
-15
View File
@@ -80,20 +80,5 @@ export default createCliPlugin({
removed("use 'backstage-cli new' instead")();
},
});
reg.addCommand({
path: ['create-github-app'],
description: 'Create new GitHub App in your organization.',
execute: async ({ args }) => {
const command = new Command();
const defaultCommand = command
.argument('<github-org>')
.action(
lazy(() => import('./commands/create-github-app'), 'default'),
);
await defaultCommand.parseAsync(args, { from: 'user' });
},
});
},
});
-5
View File
@@ -54,11 +54,6 @@ export function registerCommands(program: Command) {
.option('--no-private', 'Do not mark new packages as private')
.action(lazy(() => import('./commands/new'), 'default'));
program
.command('create-github-app <github-org>')
.description('Create new GitHub App in your organization.')
.action(lazy(() => import('./commands/create-github-app'), 'default'));
program
.command('create')
.allowUnknownOption(true)