-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: release of accentuate plugins
- Loading branch information
Showing
78 changed files
with
6,475 additions
and
3,960 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@dweber019/backstage-plugin-accentuate-backend': patch | ||
'@dweber019/backstage-plugin-accentuate-common': patch | ||
'@dweber019/backstage-plugin-accentuate': patch | ||
--- | ||
|
||
Initial release of accentuate plugins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createRouter } from '@dweber019/backstage-plugin-accentuate-backend'; | ||
import { Router } from 'express'; | ||
import { PluginEnvironment } from '../types'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
return await createRouter({ | ||
logger: env.logger, | ||
database: env.database, | ||
identity: env.identity, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Accentuate backend plugin | ||
|
||
The accentuate backend plugin merges data stored in the database with the ingested entities mostly ingested from | ||
SCM. | ||
|
||
Additionally, the plugin will provide an API to manage the data for the [accentuate frontend plugin](../accentuate/README.md). | ||
|
||
## Install | ||
|
||
### Setup plugin | ||
|
||
First we need to add the `@dweber019/backstage-plugin-accentuate-backend` package: | ||
|
||
```sh | ||
# From your Backstage root directory | ||
yarn add --cwd packages/backend @dweber019/backstage-plugin-accentuate-backend | ||
``` | ||
|
||
Then we open the file named `packages/backend/src/plugins/catalog.ts`, and extend it with: | ||
|
||
```ts | ||
import { AccentuateEntitiesProcessor } from '@dweber019/backstage-plugin-accentuate-backend'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
envAccentuate: PluginEnvironment, // required that the correct database is used in AccentuateEntitiesProcessor | ||
): Promise<Router> { | ||
const builder = await CatalogBuilder.create(env); | ||
|
||
builder.addProcessor( | ||
await AccentuateEntitiesProcessor.fromEnv(envAccentuate), | ||
); | ||
|
||
const { processingEngine, router } = await builder.build(); | ||
// .. | ||
} | ||
``` | ||
|
||
Then create a file at `packages/backend/src/plugins/accentuate.ts` with | ||
|
||
```ts | ||
import { createRouter } from '@dweber019/backstage-plugin-accentuate-backend'; | ||
import { Router } from 'express'; | ||
import { PluginEnvironment } from '../types'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
return await createRouter({ | ||
logger: env.logger, | ||
database: env.database, | ||
identity: env.identity, | ||
}); | ||
} | ||
``` | ||
|
||
Next we wire this into the overall backend router, edit `packages/backend/src/index.ts`: | ||
|
||
```ts | ||
import accentuate from './plugins/accentuate'; | ||
// ... | ||
async function main() { | ||
// ... | ||
// Add this line under the other lines that follow the useHotMemoize pattern | ||
const accentuateEnv = useHotMemoize(module, () => createEnv('accentuate')); | ||
// ... | ||
// Extend the catalog to provide the accentuateEnv | ||
apiRouter.use('/catalog', await catalog(catalogEnv, accentuateEnv)); | ||
// Insert this line under the other lines that add their routers to apiRouter in the same way | ||
apiRouter.use('/accentuate', await accentuate(accentuateEnv)); | ||
``` | ||
### New Backend System | ||
The backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up: | ||
In your `packages/backend/src/index.ts` make the following changes: | ||
```diff | ||
|
||
+ import { accentuatePlugin, catalogModuleAccentuateProcessor } from '@dweber019/backstage-plugin-accentuate-backend'; | ||
const backend = createBackend(); | ||
|
||
+ backend.add(accentuatePlugin()); | ||
+ backend.add(catalogModuleAccentuateProcessor()); | ||
|
||
// ... other feature additions | ||
|
||
backend.start(); | ||
``` | ||
> This was not tested and is here for reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export interface Config { | ||
accentuate?: { | ||
/** | ||
* The kinds allowed to be accentuated | ||
* @visibility frontend | ||
*/ | ||
allowedKinds?: string[]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Location | ||
metadata: | ||
name: accentuate | ||
description: Examples of standard kinds with accentuate | ||
spec: | ||
targets: | ||
- ./group-1.yaml | ||
- ./user-1.yaml | ||
- ./user-2.yaml | ||
- ./component-1.yaml | ||
- ./resource-1.yaml | ||
- ./system-1.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: component-accentuate | ||
spec: | ||
type: service | ||
lifecycle: production | ||
owner: group:default/group-accentuate | ||
# system | ||
# dependsOn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Group | ||
metadata: | ||
name: group-accentuate | ||
spec: | ||
type: team | ||
children: [] | ||
members: # add user-accentuate | ||
- user:default/user-accentuate-2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Resource | ||
metadata: | ||
name: resource-accentuate | ||
spec: | ||
type: db | ||
owner: group:default/group-1 # user-1 | ||
# system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: System | ||
metadata: | ||
name: system-accentuate | ||
spec: | ||
owner: group:default/group-accentuate # user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: User | ||
metadata: | ||
name: user-accentuate | ||
spec: | ||
profile: | ||
displayName: John Doe (accentuate) | ||
# email: [email protected] | ||
memberOf: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: User | ||
metadata: | ||
name: user-accentuate-2 | ||
spec: | ||
profile: | ||
displayName: John Doe (accentuate) 2 | ||
# email: [email protected] | ||
memberOf: [] |
Oops, something went wrong.