From cf9ba6f0ab261b29c683144b737cdb23bb85e8f7 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Thu, 19 Jun 2025 11:29:50 +0200 Subject: [PATCH 1/2] chore: fixing cookiecutter input values Signed-off-by: benjdlambert --- .changeset/sixty-ties-matter.md | 5 +++++ .../src/actions/fetch/cookiecutter.ts | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/sixty-ties-matter.md diff --git a/.changeset/sixty-ties-matter.md b/.changeset/sixty-ties-matter.md new file mode 100644 index 0000000000..3be0bb08a8 --- /dev/null +++ b/.changeset/sixty-ties-matter.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch +--- + +Fixing the typescript issue with using `z.unknown()` diff --git a/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts b/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts index 3a4ee8c3d7..9a9df95dea 100644 --- a/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts +++ b/plugins/scaffolder-backend-module-cookiecutter/src/actions/fetch/cookiecutter.ts @@ -169,9 +169,14 @@ export function createFetchCookiecutterAction(options: { }) .optional(), values: z => - z.record(z.unknown(), { - description: 'Values to pass on to cookiecutter for templating', - }), + z + .object( + {}, + { + description: 'Values to pass on to cookiecutter for templating', + }, + ) + .passthrough(), copyWithoutRender: z => z .array(z.string(), { From 4b0189d67252177de684548726c87c72b0d5186e Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Thu, 19 Jun 2025 12:44:27 +0200 Subject: [PATCH 2/2] chore: fixing types for cookiecutter Signed-off-by: benjdlambert --- plugins/scaffolder-backend-module-cookiecutter/report.api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-backend-module-cookiecutter/report.api.md b/plugins/scaffolder-backend-module-cookiecutter/report.api.md index 2dfba3f42f..a60a8c0396 100644 --- a/plugins/scaffolder-backend-module-cookiecutter/report.api.md +++ b/plugins/scaffolder-backend-module-cookiecutter/report.api.md @@ -4,10 +4,12 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; +import { objectOutputType } from 'zod'; import { ScmIntegrations } from '@backstage/integration'; import { TemplateAction } from '@backstage/plugin-scaffolder-node'; import { UrlReaderService } from '@backstage/backend-plugin-api'; import { Writable } from 'stream'; +import { ZodTypeAny } from 'zod'; // @public export interface ContainerRunner { @@ -47,7 +49,7 @@ export function createFetchCookiecutterAction(options: { }): TemplateAction< { url: string; - values: Record; + values: objectOutputType<{}, ZodTypeAny, 'passthrough'>; targetPath?: string | undefined; copyWithoutRender?: string[] | undefined; extensions?: string[] | undefined;