From 8630bc65484dc80b1bdfe3e5b4029268d4736108 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sun, 9 Feb 2025 13:43:03 +0100 Subject: [PATCH] cli/new: remove targetPath configuration in templates Signed-off-by: Patrik Oldsberg --- .../src/lib/new/execution/writeTemplateContents.test.ts | 2 -- .../new/preparation/collectPortableTemplateInput.test.ts | 1 - .../src/lib/new/preparation/loadPortableTemplate.test.ts | 7 ++----- .../cli/src/lib/new/preparation/loadPortableTemplate.ts | 1 - packages/cli/src/lib/new/types.ts | 1 - packages/cli/templates/default-backend-module.yaml | 1 - packages/cli/templates/default-backend-plugin.yaml | 1 - packages/cli/templates/default-common-plugin-package.yaml | 1 - packages/cli/templates/default-node-plugin-package.yaml | 1 - packages/cli/templates/default-plugin.yaml | 1 - packages/cli/templates/default-react-plugin-package.yaml | 1 - packages/cli/templates/node-library-package.yaml | 1 - packages/cli/templates/scaffolder-module.yaml | 1 - packages/cli/templates/web-library-package.yaml | 1 - 14 files changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/cli/src/lib/new/execution/writeTemplateContents.test.ts b/packages/cli/src/lib/new/execution/writeTemplateContents.test.ts index f9df3f72cd..e1f9d3d420 100644 --- a/packages/cli/src/lib/new/execution/writeTemplateContents.test.ts +++ b/packages/cli/src/lib/new/execution/writeTemplateContents.test.ts @@ -44,7 +44,6 @@ describe('writeTemplateContents', () => { id: 'test', files: [], role: 'frontend-plugin', - targetPath: 'plugins/plugin-test', templateValues: {}, }, { @@ -83,7 +82,6 @@ describe('writeTemplateContents', () => { }, ], role: 'frontend-plugin', - targetPath: 'plugins/plugin-test', templateValues: {}, }, { diff --git a/packages/cli/src/lib/new/preparation/collectPortableTemplateInput.test.ts b/packages/cli/src/lib/new/preparation/collectPortableTemplateInput.test.ts index e90e35ba45..e0ec8c8a28 100644 --- a/packages/cli/src/lib/new/preparation/collectPortableTemplateInput.test.ts +++ b/packages/cli/src/lib/new/preparation/collectPortableTemplateInput.test.ts @@ -34,7 +34,6 @@ describe('collectTemplateParams', () => { template: { id: 'test', templatePath: '/test', - targetPath: '/example', role: 'frontend-plugin' as const, files: [], templateValues: {}, diff --git a/packages/cli/src/lib/new/preparation/loadPortableTemplate.test.ts b/packages/cli/src/lib/new/preparation/loadPortableTemplate.test.ts index 1d6a67a345..4e44d783b1 100644 --- a/packages/cli/src/lib/new/preparation/loadPortableTemplate.test.ts +++ b/packages/cli/src/lib/new/preparation/loadPortableTemplate.test.ts @@ -23,7 +23,6 @@ describe('loadTemplate', () => { content: { 'path/to/template1.yaml': ` template: template1 - targetPath: plugins role: frontend-plugin `, 'path/to/template1/hello.txt': 'hello world', @@ -37,9 +36,9 @@ describe('loadTemplate', () => { expect(result).toEqual({ id: 'template1', - templatePath: mockDir.resolve('path/to/template1'), - targetPath: 'plugins', role: 'frontend-plugin', + files: [{ path: 'hello.txt', content: 'hello world' }], + templateValues: {}, }); }); @@ -96,7 +95,6 @@ describe('loadTemplate', () => { content: { 'path/to/template1.yaml': ` template: template1 - targetPath: plugins role: invalid-role `, }, @@ -119,7 +117,6 @@ describe('loadTemplate', () => { content: { 'path/to/template1.yaml': ` template: template1 - targetPath: plugins role: frontend-plugin `, }, diff --git a/packages/cli/src/lib/new/preparation/loadPortableTemplate.ts b/packages/cli/src/lib/new/preparation/loadPortableTemplate.ts index 79c528460b..2b179e9459 100644 --- a/packages/cli/src/lib/new/preparation/loadPortableTemplate.ts +++ b/packages/cli/src/lib/new/preparation/loadPortableTemplate.ts @@ -34,7 +34,6 @@ const templateDefinitionSchema = z .object({ description: z.string().optional(), template: z.string(), - targetPath: z.string(), role: z.enum(TEMPLATE_ROLES), additionalActions: z.array(z.string()).optional(), templateValues: z.record(z.string()).optional(), diff --git a/packages/cli/src/lib/new/types.ts b/packages/cli/src/lib/new/types.ts index 4521ff1867..317c1b30f2 100644 --- a/packages/cli/src/lib/new/types.ts +++ b/packages/cli/src/lib/new/types.ts @@ -67,7 +67,6 @@ export type PortableTemplateFile = { export type PortableTemplate = { id: string; description?: string; - targetPath: string; role: PortableTemplateRole; additionalActions?: string[]; files: PortableTemplateFile[]; diff --git a/packages/cli/templates/default-backend-module.yaml b/packages/cli/templates/default-backend-module.yaml index 45dde4e438..81cfd49a13 100644 --- a/packages/cli/templates/default-backend-module.yaml +++ b/packages/cli/templates/default-backend-module.yaml @@ -1,6 +1,5 @@ description: A new backend module that extends an existing backend plugin with additional features template: ./default-backend-module -targetPath: plugins role: backend-plugin-module additionalActions: - install-backend diff --git a/packages/cli/templates/default-backend-plugin.yaml b/packages/cli/templates/default-backend-plugin.yaml index 6082363f5b..b02cbc7a81 100644 --- a/packages/cli/templates/default-backend-plugin.yaml +++ b/packages/cli/templates/default-backend-plugin.yaml @@ -1,6 +1,5 @@ description: A new backend plugin template: ./default-backend-plugin -targetPath: plugins role: backend-plugin additionalActions: - install-backend diff --git a/packages/cli/templates/default-common-plugin-package.yaml b/packages/cli/templates/default-common-plugin-package.yaml index a84428ac67..9e4b9677f2 100644 --- a/packages/cli/templates/default-common-plugin-package.yaml +++ b/packages/cli/templates/default-common-plugin-package.yaml @@ -1,4 +1,3 @@ description: A new isomorphic common plugin package template: ./default-common-plugin-package -targetPath: plugins role: plugin-common-library diff --git a/packages/cli/templates/default-node-plugin-package.yaml b/packages/cli/templates/default-node-plugin-package.yaml index fd52190983..1a11cbde1e 100644 --- a/packages/cli/templates/default-node-plugin-package.yaml +++ b/packages/cli/templates/default-node-plugin-package.yaml @@ -1,4 +1,3 @@ description: A new Node.js library plugin package template: ./default-node-plugin-package -targetPath: plugins role: plugin-node-library diff --git a/packages/cli/templates/default-plugin.yaml b/packages/cli/templates/default-plugin.yaml index 5b855c6765..1bc42eb1da 100644 --- a/packages/cli/templates/default-plugin.yaml +++ b/packages/cli/templates/default-plugin.yaml @@ -1,6 +1,5 @@ description: A new frontend plugin template: ./default-plugin -targetPath: plugins role: frontend-plugin additionalActions: - install-frontend diff --git a/packages/cli/templates/default-react-plugin-package.yaml b/packages/cli/templates/default-react-plugin-package.yaml index 64290b6513..9216f36c43 100644 --- a/packages/cli/templates/default-react-plugin-package.yaml +++ b/packages/cli/templates/default-react-plugin-package.yaml @@ -1,4 +1,3 @@ description: A new web library plugin package template: ./default-react-plugin-package -targetPath: plugins role: plugin-web-library diff --git a/packages/cli/templates/node-library-package.yaml b/packages/cli/templates/node-library-package.yaml index 2a3c6df218..2e690b5ad7 100644 --- a/packages/cli/templates/node-library-package.yaml +++ b/packages/cli/templates/node-library-package.yaml @@ -1,4 +1,3 @@ description: A new node-library package, exporting shared functionality for backend plugins and modules template: ./node-library-package -targetPath: packages role: node-library diff --git a/packages/cli/templates/scaffolder-module.yaml b/packages/cli/templates/scaffolder-module.yaml index 4fa3905a26..5a773759f3 100644 --- a/packages/cli/templates/scaffolder-module.yaml +++ b/packages/cli/templates/scaffolder-module.yaml @@ -1,6 +1,5 @@ description: A module exporting custom actions for @backstage/plugin-scaffolder-backend template: ./scaffolder-module -targetPath: plugins role: backend-plugin-module params: pluginId: scaffolder diff --git a/packages/cli/templates/web-library-package.yaml b/packages/cli/templates/web-library-package.yaml index e2150396ff..f0c1e1baae 100644 --- a/packages/cli/templates/web-library-package.yaml +++ b/packages/cli/templates/web-library-package.yaml @@ -1,4 +1,3 @@ description: A new web-library package, exporting shared functionality for frontend plugins template: ./web-library-package -targetPath: packages role: web-library