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