Rename catalog-node plugin, add scaffolder extension

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-07-07 14:00:12 +02:00
committed by Patrik Oldsberg
parent 634b191757
commit 506ddb6ac8
6 changed files with 71 additions and 26 deletions
+3 -24
View File
@@ -15,29 +15,8 @@
*/
import { createBackend } from '@backstage/backend-app-api';
// import { createBackendModule } from '@backstage/backend-plugin-api';
import {
catalogPlugin,
// catalogProcessingInitApiRef,
} from '@backstage/plugin-catalog-backend';
// import { ScaffolderEntitiesProcessor } from '@backstage/plugin-scaffolder-backend';
// export const scaffolderCatalogExtension = createBackendModule({
// moduleId: 'scaffolder.extention',
// pluginId: 'catalog',
// register(env) {
// env.registerInit({
// deps: {
// catalogProcessingInitApi: catalogProcessingInitApiRef,
// },
// async init({ catalogProcessingInitApi }) {
// catalogProcessingInitApi.addProcessor(
// new ScaffolderEntitiesProcessor(),
// );
// },
// });
// },
// });
import { catalogPlugin } from '@backstage/plugin-catalog-backend';
import { scaffolderCatalogExtension } from '@backstage/plugin-scaffolder-backend';
// export const appPlugin = createBackendPlugin({
// id: 'app',
@@ -68,5 +47,5 @@ const backend = createBackend({
});
backend.add(catalogPlugin({}));
// backend.add(scaffolderCatalogExtension({}));
backend.add(scaffolderCatalogExtension({}));
backend.start();
+6
View File
@@ -5,6 +5,7 @@
```ts
/// <reference types="node" />
import { BackendRegistrable } from '@backstage/backend-plugin-api';
import { CatalogApi } from '@backstage/catalog-client';
import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
@@ -543,6 +544,11 @@ export type RunCommandOptions = {
logStream?: Writable;
};
// @alpha
export const scaffolderCatalogExtension: (
option: unknown,
) => BackendRegistrable;
// @public (undocumented)
export class ScaffolderEntitiesProcessor implements CatalogProcessor {
// (undocumented)
+6 -2
View File
@@ -9,7 +9,8 @@
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"types": "dist/index.d.ts",
"alphaTypes": "dist/index.alpha.d.ts"
},
"backstage": {
"role": "backend-plugin"
@@ -25,7 +26,7 @@
],
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"build": "backstage-cli package build --experimental-type-build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
@@ -42,6 +43,8 @@
"@backstage/integration": "^1.2.2-next.2",
"@backstage/plugin-catalog-backend": "^1.2.1-next.2",
"@backstage/plugin-scaffolder-common": "^1.1.2-next.0",
"@backstage/backend-plugin-api": "^0.0.0",
"@backstage/plugin-catalog-node": "^0.0.0",
"@backstage/types": "^1.0.0",
"@gitbeaker/core": "^35.6.0",
"@gitbeaker/node": "^35.1.0",
@@ -93,6 +96,7 @@
"yaml": "^1.10.0"
},
"files": [
"alpha",
"dist",
"migrations",
"config.d.ts",
@@ -0,0 +1,39 @@
/*
* Copyright 2022 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 } from '@backstage/backend-plugin-api';
import { catalogProcessingExtentionPoint } from '@backstage/plugin-catalog-node';
import { ScaffolderEntitiesProcessor } from '../processor';
/**
* @alpha
* Registers the ScaffolderEntitiesProcessor with the catalog processing extension point.
*/
export const scaffolderCatalogExtension = createBackendModule({
moduleId: 'scaffolder.extention',
pluginId: 'catalog',
register(env) {
env.registerInit({
deps: {
catalogProcessingExtensionPoint: catalogProcessingExtentionPoint,
},
async init({ catalogProcessingExtensionPoint }) {
catalogProcessingExtensionPoint.addProcessor(
new ScaffolderEntitiesProcessor(),
);
},
});
},
});
@@ -0,0 +1,16 @@
/*
* Copyright 2022 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 { scaffolderCatalogExtension } from './ScaffolderCatalogExtension';
+1
View File
@@ -24,3 +24,4 @@ export * from './scaffolder';
export * from './service/router';
export * from './lib';
export * from './processor';
export * from './extension';