From b392a34833d88008e91c8d7e0d97b3c79bc781b2 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Wed, 4 Jun 2025 08:27:47 +0200 Subject: [PATCH] chore: migrate to new actions format Signed-off-by: benjdlambert --- .changeset/green-schools-live.md | 5 +++ .../report.api.md | 11 ++--- .../src/actions/run/yeoman.ts | 43 +++++++------------ 3 files changed, 27 insertions(+), 32 deletions(-) create mode 100644 .changeset/green-schools-live.md diff --git a/.changeset/green-schools-live.md b/.changeset/green-schools-live.md new file mode 100644 index 0000000000..9863021a28 --- /dev/null +++ b/.changeset/green-schools-live.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-yeoman': patch +--- + +Migrate to new actions format diff --git a/plugins/scaffolder-backend-module-yeoman/report.api.md b/plugins/scaffolder-backend-module-yeoman/report.api.md index 57498bbe3a..cb4df446cb 100644 --- a/plugins/scaffolder-backend-module-yeoman/report.api.md +++ b/plugins/scaffolder-backend-module-yeoman/report.api.md @@ -4,18 +4,19 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -import { JsonObject } from '@backstage/types'; import { TemplateAction } from '@backstage/plugin-scaffolder-node'; // @public export function createRunYeomanAction(): TemplateAction< { namespace: string; - args?: string[]; - options?: JsonObject; + args?: string[] | undefined; + options?: Record | undefined; }, - JsonObject, - 'v1' + { + [x: string]: any; + }, + 'v2' >; // @public diff --git a/plugins/scaffolder-backend-module-yeoman/src/actions/run/yeoman.ts b/plugins/scaffolder-backend-module-yeoman/src/actions/run/yeoman.ts index a8bbbf945d..aec9e3a415 100644 --- a/plugins/scaffolder-backend-module-yeoman/src/actions/run/yeoman.ts +++ b/plugins/scaffolder-backend-module-yeoman/src/actions/run/yeoman.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { JsonObject } from '@backstage/types'; import { createTemplateAction } from '@backstage/plugin-scaffolder-node'; import { yeomanRun } from './yeomanRun'; import { examples } from './yeoman.examples'; @@ -29,38 +28,28 @@ import { examples } from './yeoman.examples'; * @public */ export function createRunYeomanAction() { - return createTemplateAction<{ - namespace: string; - args?: string[]; - options?: JsonObject; - }>({ + return createTemplateAction({ id: 'run:yeoman', description: 'Runs Yeoman on an installed Yeoman generator', examples, schema: { input: { - type: 'object', - required: ['namespace'], - properties: { - namespace: { - title: 'Generator Namespace', + namespace: z => + z.string({ description: 'Yeoman generator namespace, e.g: node:app', - type: 'string', - }, - args: { - title: 'Generator Arguments', - description: 'Arguments to pass on to Yeoman for templating', - type: 'array', - items: { - type: 'string', - }, - }, - options: { - title: 'Generator Options', - description: 'Options to pass on to Yeoman for templating', - type: 'object', - }, - }, + }), + args: z => + z + .array(z.string(), { + description: 'Arguments to pass on to Yeoman for templating', + }) + .optional(), + options: z => + z + .record(z.any(), { + description: 'Options to pass on to Yeoman for templating', + }) + .optional(), }, }, supportsDryRun: true,