cli-module-new: add template for CLI module packages
Add a new `cli-module` template to the Backstage CLI that scaffolds CLI module packages. This includes adding the `cli-module` role to the template system, with proper naming conventions and prompts. The generated package includes: - A bin entry point for standalone execution - An index.ts with createCliModule setup - An example command using cleye - Standard package.json with cli-module role Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com> Made-with: Cursor
This commit is contained in:
@@ -23,6 +23,7 @@ export const defaultTemplates = [
|
||||
'@backstage/cli/templates/plugin-common-library',
|
||||
'@backstage/cli/templates/web-library',
|
||||
'@backstage/cli/templates/node-library',
|
||||
'@backstage/cli/templates/cli-module',
|
||||
'@backstage/cli/templates/catalog-provider-module',
|
||||
'@backstage/cli/templates/scaffolder-backend-module',
|
||||
];
|
||||
|
||||
@@ -160,6 +160,7 @@ export function getPromptsForRole(
|
||||
case 'web-library':
|
||||
case 'node-library':
|
||||
case 'common-library':
|
||||
case 'cli-module':
|
||||
return [namePrompt()];
|
||||
case 'plugin-web-library':
|
||||
case 'plugin-node-library':
|
||||
|
||||
@@ -37,6 +37,13 @@ describe.each([
|
||||
packagePath: 'packages/test',
|
||||
},
|
||||
],
|
||||
[
|
||||
{ role: 'cli-module', name: 'test' },
|
||||
{
|
||||
packageName: '@internal/cli-module-test',
|
||||
packagePath: 'packages/cli-module-test',
|
||||
},
|
||||
],
|
||||
[
|
||||
{ role: 'plugin-web-library', pluginId: 'test' },
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ function getBaseNameForRole(
|
||||
case 'node-library':
|
||||
case 'common-library':
|
||||
return roleParams.name;
|
||||
case 'cli-module':
|
||||
return `cli-module-${roleParams.name}`;
|
||||
case 'plugin-web-library':
|
||||
return `${roleParams.pluginId}-react`;
|
||||
case 'plugin-node-library':
|
||||
|
||||
@@ -50,6 +50,7 @@ export const TEMPLATE_ROLES = [
|
||||
'web-library',
|
||||
'node-library',
|
||||
'common-library',
|
||||
'cli-module',
|
||||
'plugin-web-library',
|
||||
'plugin-node-library',
|
||||
'plugin-common-library',
|
||||
@@ -80,7 +81,7 @@ export type PortableTemplateParams = {
|
||||
|
||||
export type PortableTemplateInputRoleParams =
|
||||
| {
|
||||
role: 'web-library' | 'node-library' | 'common-library';
|
||||
role: 'web-library' | 'node-library' | 'common-library' | 'cli-module';
|
||||
name: string;
|
||||
}
|
||||
| {
|
||||
|
||||
Reference in New Issue
Block a user