Merge pull request #24986 from backstage/blam/add-module-support-to-scaffolder-action

feat: module export for scaffolder action cli template
This commit is contained in:
Ben Lambert
2024-06-18 10:51:07 +02:00
committed by GitHub
4 changed files with 33 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Export default module for `scaffolder-action` cli template
@@ -80,6 +80,7 @@ describe('scaffolderModule factory', () => {
'copying example.test.ts',
'copying example.ts',
'copying index.ts',
'copying module.ts',
'Installing:',
`moving plugins${sep}scaffolder-backend-module-test`,
]);
@@ -1 +1,7 @@
import { scaffolderModule } from './module';
/*
@deprecated - this way of importing modules will soon be unsupported, and you should use `backend.add(import(...))` instead.
*/
export { createAcmeExampleAction } from './example';
export default scaffolderModule;
@@ -0,0 +1,21 @@
import { createBackendModule } from "@backstage/backend-plugin-api";
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createAcmeExampleAction } from "./example";
/**
* A backend module that registers the action into the scaffolder
*/
export const scaffolderModule = createBackendModule({
moduleId: 'acme:example',
pluginId: 'scaffolder',
register({ registerInit }) {
registerInit({
deps: {
scaffolderActions: scaffolderActionsExtensionPoint
},
async init({ scaffolderActions}) {
scaffolderActions.addActions(createAcmeExampleAction());
}
});
},
})