From 6833b035e788c0823ecb628a2602f9bf536e00ca Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 18 Jan 2024 16:31:56 +0100 Subject: [PATCH] feat: cookiecutter to module Signed-off-by: blam Signed-off-by: blam --- .../api-report-alpha.md | 13 +++++ .../package.json | 16 ++++++ .../src/alpha.ts | 16 ++++++ .../src/module.ts | 50 +++++++++++++++++++ .../api-report-alpha.md | 13 +++++ .../package.json | 16 ++++++ .../src/alpha.ts | 16 ++++++ .../src/module.ts | 46 +++++++++++++++++ 8 files changed, 186 insertions(+) create mode 100644 plugins/scaffolder-backend-module-confluence-to-markdown/api-report-alpha.md create mode 100644 plugins/scaffolder-backend-module-confluence-to-markdown/src/alpha.ts create mode 100644 plugins/scaffolder-backend-module-confluence-to-markdown/src/module.ts create mode 100644 plugins/scaffolder-backend-module-cookiecutter/api-report-alpha.md create mode 100644 plugins/scaffolder-backend-module-cookiecutter/src/alpha.ts create mode 100644 plugins/scaffolder-backend-module-cookiecutter/src/module.ts diff --git a/plugins/scaffolder-backend-module-confluence-to-markdown/api-report-alpha.md b/plugins/scaffolder-backend-module-confluence-to-markdown/api-report-alpha.md new file mode 100644 index 0000000000..5717a7b130 --- /dev/null +++ b/plugins/scaffolder-backend-module-confluence-to-markdown/api-report-alpha.md @@ -0,0 +1,13 @@ +## API Report File for "@backstage/plugin-scaffolder-backend-module-confluence-to-markdown" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackendFeature } from '@backstage/backend-plugin-api'; + +// @alpha +const confluenceToMarkdownModule: () => BackendFeature; +export default confluenceToMarkdownModule; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder-backend-module-confluence-to-markdown/package.json b/plugins/scaffolder-backend-module-confluence-to-markdown/package.json index 2f0bd5188c..7f08015a49 100644 --- a/plugins/scaffolder-backend-module-confluence-to-markdown/package.json +++ b/plugins/scaffolder-backend-module-confluence-to-markdown/package.json @@ -19,6 +19,21 @@ "url": "https://github.com/backstage/backstage", "directory": "plugins/scaffolder-backend-module-confluence-to-markdown" }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } + }, "scripts": { "start": "backstage-cli package start", "build": "backstage-cli package build", @@ -31,6 +46,7 @@ }, "dependencies": { "@backstage/backend-common": "workspace:^", + "@backstage/backend-plugin-api": "workspace:^", "@backstage/config": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/integration": "workspace:^", diff --git a/plugins/scaffolder-backend-module-confluence-to-markdown/src/alpha.ts b/plugins/scaffolder-backend-module-confluence-to-markdown/src/alpha.ts new file mode 100644 index 0000000000..e6044e315f --- /dev/null +++ b/plugins/scaffolder-backend-module-confluence-to-markdown/src/alpha.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export { confluenceToMarkdownModule as default } from './module'; diff --git a/plugins/scaffolder-backend-module-confluence-to-markdown/src/module.ts b/plugins/scaffolder-backend-module-confluence-to-markdown/src/module.ts new file mode 100644 index 0000000000..72ca6e701a --- /dev/null +++ b/plugins/scaffolder-backend-module-confluence-to-markdown/src/module.ts @@ -0,0 +1,50 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { + createBackendModule, + coreServices, +} from '@backstage/backend-plugin-api'; +import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; +import { createConfluenceToMarkdownAction } from './actions'; +import { ScmIntegrations } from '@backstage/integration'; + +/** + * @alpha + * The Confluence to Markdown Module for the Scaffolder Backend + */ +export const confluenceToMarkdownModule = createBackendModule({ + pluginId: 'scaffolder', + moduleId: 'confluence-to-markdown', + register({ registerInit }) { + registerInit({ + deps: { + scaffolder: scaffolderActionsExtensionPoint, + config: coreServices.rootConfig, + reader: coreServices.urlReader, + }, + async init({ scaffolder, config, reader }) { + const integrations = ScmIntegrations.fromConfig(config); + scaffolder.addActions( + createConfluenceToMarkdownAction({ + config, + integrations, + reader, + }), + ); + }, + }); + }, +}); diff --git a/plugins/scaffolder-backend-module-cookiecutter/api-report-alpha.md b/plugins/scaffolder-backend-module-cookiecutter/api-report-alpha.md new file mode 100644 index 0000000000..4e8e502307 --- /dev/null +++ b/plugins/scaffolder-backend-module-cookiecutter/api-report-alpha.md @@ -0,0 +1,13 @@ +## API Report File for "@backstage/plugin-scaffolder-backend-module-cookiecutter" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts +import { BackendFeature } from '@backstage/backend-plugin-api'; + +// @alpha +const cookiecutterModule: () => BackendFeature; +export default cookiecutterModule; + +// (No @packageDocumentation comment for this package) +``` diff --git a/plugins/scaffolder-backend-module-cookiecutter/package.json b/plugins/scaffolder-backend-module-cookiecutter/package.json index 98e96a491d..645542ef24 100644 --- a/plugins/scaffolder-backend-module-cookiecutter/package.json +++ b/plugins/scaffolder-backend-module-cookiecutter/package.json @@ -19,6 +19,21 @@ "url": "https://github.com/backstage/backstage", "directory": "plugins/scaffolder-backend-module-cookiecutter" }, + "exports": { + ".": "./src/index.ts", + "./alpha": "./src/alpha.ts", + "./package.json": "./package.json" + }, + "typesVersions": { + "*": { + "alpha": [ + "src/alpha.ts" + ], + "package.json": [ + "package.json" + ] + } + }, "scripts": { "start": "backstage-cli package start", "build": "backstage-cli package build", @@ -30,6 +45,7 @@ }, "dependencies": { "@backstage/backend-common": "workspace:^", + "@backstage/backend-plugin-api": "workspace:^", "@backstage/config": "workspace:^", "@backstage/errors": "workspace:^", "@backstage/integration": "workspace:^", diff --git a/plugins/scaffolder-backend-module-cookiecutter/src/alpha.ts b/plugins/scaffolder-backend-module-cookiecutter/src/alpha.ts new file mode 100644 index 0000000000..335b3e5107 --- /dev/null +++ b/plugins/scaffolder-backend-module-cookiecutter/src/alpha.ts @@ -0,0 +1,16 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export { cookiecutterModule as default } from './module'; diff --git a/plugins/scaffolder-backend-module-cookiecutter/src/module.ts b/plugins/scaffolder-backend-module-cookiecutter/src/module.ts new file mode 100644 index 0000000000..b89aac81c5 --- /dev/null +++ b/plugins/scaffolder-backend-module-cookiecutter/src/module.ts @@ -0,0 +1,46 @@ +/* + * Copyright 2024 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { + coreServices, + createBackendModule, +} from '@backstage/backend-plugin-api'; +import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha'; +import { createFetchCookiecutterAction } from './actions'; +import { ScmIntegrations } from '@backstage/integration'; + +/** + * @alpha + * The Cookiecutter Module for the Scaffolder Backend + */ +export const cookiecutterModule = createBackendModule({ + pluginId: 'scaffolder', + moduleId: 'cookiecutter', + register({ registerInit }) { + registerInit({ + deps: { + scaffolder: scaffolderActionsExtensionPoint, + config: coreServices.rootConfig, + reader: coreServices.urlReader, + }, + async init({ scaffolder, config, reader }) { + const integrations = ScmIntegrations.fromConfig(config); + scaffolder.addActions( + createFetchCookiecutterAction({ reader, integrations }), + ); + }, + }); + }, +});