From 61315a9ee40532ce0a70dad43232e8bd8e7e336f Mon Sep 17 00:00:00 2001 From: aramissennyeydd Date: Wed, 6 Mar 2024 18:24:44 -0500 Subject: [PATCH] update template folder structure Signed-off-by: aramissennyeydd Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd --- .../package/schema/openapi/generate/client.ts | 2 +- .../package/schema/openapi/generate/server.ts | 9 +++++++-- ...t.yaml => typescript-backstage-client.yaml} | 18 +++++++++--------- .../api.mustache | 0 .../apis/index.mustache | 0 .../index.mustache | 0 .../licenseInfo.mustache | 0 .../model.mustache | 0 .../modelAlias.mustache | 0 .../modelEnum.mustache | 0 .../modelGeneric.mustache | 0 .../modelGenericAdditionalProperties.mustache | 0 .../modelGenericEnums.mustache | 0 .../modelOneOf.mustache | 0 .../modelTaggedUnion.mustache | 0 .../models/models_all.mustache | 0 .../pluginId.mustache | 0 .../types/discovery.ts | 0 .../types/fetch.ts | 0 ...r.yaml => typescript-backstage-server.yaml} | 8 ++++---- .../api.mustache | 0 .../apis/index.mustache | 0 .../index.mustache | 0 .../licenseInfo.mustache | 5 +++++ 24 files changed, 26 insertions(+), 16 deletions(-) rename packages/repo-tools/templates/{typescript-backstage.client.yaml => typescript-backstage-client.yaml} (79%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/api.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/apis/index.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/index.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/licenseInfo.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/model.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelAlias.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelEnum.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelGeneric.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelGenericAdditionalProperties.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelGenericEnums.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelOneOf.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage => typescript-backstage-client}/modelTaggedUnion.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/models/models_all.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/pluginId.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/types/discovery.ts (100%) rename packages/repo-tools/templates/{typescript-backstage/client => typescript-backstage-client}/types/fetch.ts (100%) rename packages/repo-tools/templates/{typescript-backstage.server.yaml => typescript-backstage-server.yaml} (72%) rename packages/repo-tools/templates/{typescript-backstage/server => typescript-backstage-server}/api.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/server => typescript-backstage-server}/apis/index.mustache (100%) rename packages/repo-tools/templates/{typescript-backstage/server => typescript-backstage-server}/index.mustache (100%) create mode 100644 packages/repo-tools/templates/typescript-backstage-server/licenseInfo.mustache diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts index b9787a81d6..1dd38eb6c5 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/client.ts @@ -63,7 +63,7 @@ async function generate( '-c', resolvePackagePath( '@backstage/repo-tools', - 'templates/typescript-backstage.client.yaml', + 'templates/typescript-backstage-client.yaml', ), '--generator-key', 'v3.0', diff --git a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts index 4775cb872f..05f7d48c2d 100644 --- a/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts +++ b/packages/repo-tools/src/commands/package/schema/openapi/generate/server.ts @@ -78,6 +78,11 @@ async function generate(abortSignal?: AbortController) { OPENAPI_IGNORE_FILES.join('\n'), ); + const additionalProperties = []; + if (clientPackage) { + additionalProperties.push(`clientPackageName=${clientPackage}`); + } + await exec( 'node', [ @@ -92,9 +97,9 @@ async function generate(abortSignal?: AbortController) { '-c', resolvePackagePath( '@backstage/repo-tools', - 'templates/typescript-backstage.server.yaml', + 'templates/typescript-backstage-server.yaml', ), - `--additional-properties=clientPackageName=@backstage/catalog-client`, + `--additional-properties=${additionalProperties.join(',')}`, '--generator-key', 'v3.0', ], diff --git a/packages/repo-tools/templates/typescript-backstage.client.yaml b/packages/repo-tools/templates/typescript-backstage-client.yaml similarity index 79% rename from packages/repo-tools/templates/typescript-backstage.client.yaml rename to packages/repo-tools/templates/typescript-backstage-client.yaml index 823f6326c7..785ffde881 100644 --- a/packages/repo-tools/templates/typescript-backstage.client.yaml +++ b/packages/repo-tools/templates/typescript-backstage-client.yaml @@ -1,11 +1,11 @@ -templateDir: templates/typescript-backstage +templateDir: templates/typescript-backstage-client files: - client/api.mustache: + api.mustache: templateType: API # For some reason, they check for destinationFilename differences. We have to change the ending to override the file. destinationFilename: .client.ts - client/model.mustache: + model.mustache: templateType: Model destinationFilename: .model.ts modelGeneric.mustache: @@ -22,19 +22,19 @@ files: templateType: SupportingFiles modelTaggedUnion.mustache: templateType: SupportingFiles - client/models/models_all.mustache: + models/models_all.mustache: templateType: SupportingFiles destinationFilename: models/index.ts - client/types/fetch.ts: + types/fetch.ts: destinationFilename: types/fetch.ts - client/types/discovery.ts: + types/discovery.ts: destinationFilename: types/discovery.ts - client/apis/index.mustache: + apis/index.mustache: templateType: SupportingFiles destinationFilename: apis/index.ts - client/pluginId.mustache: + pluginId.mustache: templateType: SupportingFiles destinationFilename: pluginId.ts - client/index.mustache: + index.mustache: templateType: SupportingFiles destinationFilename: index.ts diff --git a/packages/repo-tools/templates/typescript-backstage/client/api.mustache b/packages/repo-tools/templates/typescript-backstage-client/api.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/api.mustache rename to packages/repo-tools/templates/typescript-backstage-client/api.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/apis/index.mustache b/packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/apis/index.mustache rename to packages/repo-tools/templates/typescript-backstage-client/apis/index.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/index.mustache b/packages/repo-tools/templates/typescript-backstage-client/index.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/index.mustache rename to packages/repo-tools/templates/typescript-backstage-client/index.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/licenseInfo.mustache b/packages/repo-tools/templates/typescript-backstage-client/licenseInfo.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/licenseInfo.mustache rename to packages/repo-tools/templates/typescript-backstage-client/licenseInfo.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/model.mustache b/packages/repo-tools/templates/typescript-backstage-client/model.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/model.mustache rename to packages/repo-tools/templates/typescript-backstage-client/model.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelAlias.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelAlias.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelAlias.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelAlias.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelEnum.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelEnum.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelEnum.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelGeneric.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelGeneric.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelGeneric.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelGeneric.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelGenericAdditionalProperties.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelGenericAdditionalProperties.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelGenericAdditionalProperties.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelGenericAdditionalProperties.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelGenericEnums.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelGenericEnums.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelGenericEnums.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelGenericEnums.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelOneOf.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelOneOf.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelOneOf.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelOneOf.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/modelTaggedUnion.mustache b/packages/repo-tools/templates/typescript-backstage-client/modelTaggedUnion.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/modelTaggedUnion.mustache rename to packages/repo-tools/templates/typescript-backstage-client/modelTaggedUnion.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/models/models_all.mustache b/packages/repo-tools/templates/typescript-backstage-client/models/models_all.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/models/models_all.mustache rename to packages/repo-tools/templates/typescript-backstage-client/models/models_all.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/pluginId.mustache b/packages/repo-tools/templates/typescript-backstage-client/pluginId.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/pluginId.mustache rename to packages/repo-tools/templates/typescript-backstage-client/pluginId.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/client/types/discovery.ts b/packages/repo-tools/templates/typescript-backstage-client/types/discovery.ts similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/types/discovery.ts rename to packages/repo-tools/templates/typescript-backstage-client/types/discovery.ts diff --git a/packages/repo-tools/templates/typescript-backstage/client/types/fetch.ts b/packages/repo-tools/templates/typescript-backstage-client/types/fetch.ts similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/client/types/fetch.ts rename to packages/repo-tools/templates/typescript-backstage-client/types/fetch.ts diff --git a/packages/repo-tools/templates/typescript-backstage.server.yaml b/packages/repo-tools/templates/typescript-backstage-server.yaml similarity index 72% rename from packages/repo-tools/templates/typescript-backstage.server.yaml rename to packages/repo-tools/templates/typescript-backstage-server.yaml index 1ad35ebe53..ff663a06ea 100644 --- a/packages/repo-tools/templates/typescript-backstage.server.yaml +++ b/packages/repo-tools/templates/typescript-backstage-server.yaml @@ -1,13 +1,13 @@ -templateDir: templates/typescript-backstage +templateDir: templates/typescript-backstage-server files: - server/api.mustache: + api.mustache: templateType: API # For some reason, they check for destinationFilename differences. We have to change the ending to override the file. destinationFilename: .server.ts - server/apis/index.mustache: + apis/index.mustache: templateType: SupportingFiles destinationFilename: apis/index.ts - server/index.mustache: + index.mustache: templateType: SupportingFiles destinationFilename: index.ts diff --git a/packages/repo-tools/templates/typescript-backstage/server/api.mustache b/packages/repo-tools/templates/typescript-backstage-server/api.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/server/api.mustache rename to packages/repo-tools/templates/typescript-backstage-server/api.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/server/apis/index.mustache b/packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/server/apis/index.mustache rename to packages/repo-tools/templates/typescript-backstage-server/apis/index.mustache diff --git a/packages/repo-tools/templates/typescript-backstage/server/index.mustache b/packages/repo-tools/templates/typescript-backstage-server/index.mustache similarity index 100% rename from packages/repo-tools/templates/typescript-backstage/server/index.mustache rename to packages/repo-tools/templates/typescript-backstage-server/index.mustache diff --git a/packages/repo-tools/templates/typescript-backstage-server/licenseInfo.mustache b/packages/repo-tools/templates/typescript-backstage-server/licenseInfo.mustache new file mode 100644 index 0000000000..7a1b10e780 --- /dev/null +++ b/packages/repo-tools/templates/typescript-backstage-server/licenseInfo.mustache @@ -0,0 +1,5 @@ +// + +// ****************************************************************** +// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. * +// ****************************************************************** \ No newline at end of file