Skip to content

Commit

Permalink
feat(scaffolder-relation)!: migrate to new backend and remove depreca…
Browse files Browse the repository at this point in the history
…tions

Signed-off-by: Patrick <pknight@redhat.com>
  • Loading branch information
PatAKnight committed Oct 1, 2024
1 parent 3415189 commit 0dd48a9
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 613 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor': major
---

**Breaking** migrate to the new backend system and remove deprecations
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,14 @@ const backend = createBackend();
// highlight-add-start
backend.add(
import(
'@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor/alpha'
'@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor'
),
);
// highlight-add-end

backend.start();
```

### Installing on the legacy backend system

To install this module into the legacy backend system, add the following to the `packages/backend/src/plugins/catalog.ts` file:

```ts title=packages/backend/src/plugins/catalog.ts
// highlight-add-start
import { ScaffolderRelationEntityProcessor } from '@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor';

// highlight-add-end

export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const builder = await CatalogBuilder.create(env);

/* ... other processors and/or providers ... */
// highlight-add-start
builder.addProcessor(new ScaffolderRelationEntityProcessor());
// highlight-add-end

const { processingEngine, router } = await builder.build();
await processingEngine.start();

return router;
}
```

### Usage

Catalog entities containing the `spec.scaffoldedFrom` field will have a relation link be formed between it and the `template` corresponding to the entity ref in the `spec.scaffoldedFrom` field.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackendDynamicPluginInstaller } from '@backstage/backend-dynamic-feature-service';
import { BackendFeature } from '@backstage/backend-plugin-api';
import { CatalogProcessor } from '@backstage/plugin-catalog-node';
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
import { Entity } from '@backstage/catalog-model';
import { LocationSpec } from '@backstage/plugin-catalog-common';
import type { LocationSpec } from '@backstage/plugin-catalog-common';

// @public (undocumented)
export const dynamicPluginInstaller: BackendDynamicPluginInstaller;
// @public
const catalogModuleScaffolderRelationProcessor: BackendFeature;
export default catalogModuleScaffolderRelationProcessor;

// @public
export const RELATION_SCAFFOLDED_FROM = 'scaffoldedFrom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
{
"name": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor-dynamic",
"description": "The scaffolder-relation-processor backend module for the catalog plugin.",
"version": "0.0.0",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",
"version": "1.2.9",
"main": "./dist/index.cjs.js",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/backstage/community-plugins",
"directory": "workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor"
},
"backstage": {
"role": "backend-plugin-module"
"role": "backend-plugin-module",
"pluginId": "scaffolder-relation-processor",
"pluginPackage": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor"
},
"exports": {
".": {
"require": "./dist/index.cjs.js",
"default": "./dist/index.cjs.js"
},
"./alpha": {
"require": "./dist/alpha.cjs.js",
"default": "./dist/alpha.cjs.js"
},
"./package.json": "./package.json"
},
"files": [
"dist",
"config.d.ts",
"alpha"
"config.d.ts"
],
"bundleDependencies": true,
"peerDependencies": {
"@backstage/backend-common": "^0.21.6",
"@backstage/backend-dynamic-feature-service": "^0.2.8",
"@backstage/backend-plugin-api": "^0.6.16",
"@backstage/catalog-model": "^1.4.5",
"@backstage/plugin-catalog-common": "^1.0.22",
"@backstage/plugin-catalog-node": "^1.11.1"
"@backstage/backend-plugin-api": "^1.0.0",
"@backstage/catalog-model": "^1.7.0",
"@backstage/plugin-catalog-node": "^1.13.0"
},
"overrides": {
"@aws-sdk/util-utf8-browser": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor-dynamic@workspace:."
peerDependencies:
"@backstage/backend-common": ^0.21.6
"@backstage/backend-dynamic-feature-service": ^0.2.8
"@backstage/backend-plugin-api": ^0.6.16
"@backstage/catalog-model": ^1.4.5
"@backstage/plugin-catalog-common": ^1.0.22
"@backstage/plugin-catalog-node": ^1.11.1
"@backstage/backend-plugin-api": ^1.0.0
"@backstage/catalog-model": ^1.7.0
"@backstage/plugin-catalog-node": ^1.13.0
languageName: unknown
linkType: soft
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
Expand All @@ -46,16 +42,14 @@
"tsc": "tsc"
},
"dependencies": {
"@backstage/backend-common": "^0.25.0",
"@backstage/backend-dynamic-feature-service": "^0.4.1",
"@backstage/backend-plugin-api": "^1.0.0",
"@backstage/catalog-model": "^1.7.0",
"@backstage/plugin-catalog-common": "^1.1.0",
"@backstage/plugin-catalog-node": "^1.13.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^1.0.0",
"@backstage/cli": "^0.27.1",
"@backstage/plugin-catalog-common": "^1.1.0",
"@janus-idp/cli": "1.13.1"
},
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import type { Entity } from '@backstage/catalog-model';

import { ScaffolderRelationEntityProcessor } from './ScaffolderRelationEntityProcessor';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import {
getCompoundEntityRef,
parseEntityRef,
} from '@backstage/catalog-model';
import { LocationSpec } from '@backstage/plugin-catalog-common';
import type { LocationSpec } from '@backstage/plugin-catalog-common';
import {
CatalogProcessor,
CatalogProcessorEmit,
processingResult,
} from '@backstage/plugin-catalog-node';

import { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF } from './relations';
import { ScaffoldedFromSpec } from './types';
import type { ScaffoldedFromSpec } from './types';

/** @public */
export class ScaffolderRelationEntityProcessor implements CatalogProcessor {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/
export * from './relations';
export * from './types';
export * from './dynamic/index';
export { catalogModuleScaffolderRelationProcessor as default } from './module';
export * from './ScaffolderRelationEntityProcessor';
Loading

0 comments on commit 0dd48a9

Please sign in to comment.