@axis-backstage/plugin-readme 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +42 -3
- package/dist/alpha.d.ts +51 -0
- package/dist/alpha.esm.js +29 -0
- package/dist/alpha.esm.js.map +1 -0
- package/package.json +40 -18
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The `Readme-plugin` enables easy access and viewing of the README file. By havin
|
|
|
10
10
|
|
|
11
11
|
The plugin **supports all ScmIntegrations**, like Gerrit & GitLab. This makes it possible for organizations with many Source Code Integrations to use the same plugin.
|
|
12
12
|
|
|
13
|
-
It also supports various file
|
|
13
|
+
It also supports various file extensions such as README.md, README.MD, README.txt, README, and README.rst.
|
|
14
14
|
|
|
15
15
|
### Where can the plugin find my README file?
|
|
16
16
|
|
|
@@ -80,6 +80,45 @@ const defaultEntityPage = (
|
|
|
80
80
|
)
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### New Frontend System
|
|
84
|
+
|
|
85
|
+
1. First, install the plugin into your app:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# From your Backstage root directory
|
|
89
|
+
yarn --cwd packages/app add @axis-backstage/plugin-readme
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. If [feature discovery](https://backstage.io/docs/frontend-system/architecture/app/#feature-discovery) is enabled in your app, the plugin will be automatically discovered and added to the entity page. If not, you can manually add the plugin to your app:
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
// packages/app/src/App.tsx
|
|
96
|
+
// ...
|
|
97
|
+
import readmePlugin from '@axis-backstage/plugin-readme/alpha';
|
|
98
|
+
|
|
99
|
+
const app = createApp({
|
|
100
|
+
features: [
|
|
101
|
+
// ...
|
|
102
|
+
readmePlugin,
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. If necessary, you can also customize the plugin:
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
# app-config.yaml
|
|
111
|
+
app:
|
|
112
|
+
# ...
|
|
113
|
+
extensions:
|
|
114
|
+
# ...
|
|
115
|
+
- entity-card:readme:
|
|
116
|
+
config:
|
|
117
|
+
filter:
|
|
118
|
+
kind: component
|
|
119
|
+
# ...
|
|
120
|
+
```
|
|
121
|
+
|
|
83
122
|
## Layout
|
|
84
123
|
|
|
85
124
|
The readme card is located in the overview page on the entity page. From the card header it is also possible to open a dialog displaying the full README.md.
|
|
@@ -101,8 +140,8 @@ Addition to this; ensure that `backstage:source-location` value has the trailing
|
|
|
101
140
|
metadata:
|
|
102
141
|
annotations:
|
|
103
142
|
# This will not work
|
|
104
|
-
backstage
|
|
143
|
+
backstage.io/source-location: url:https://bitbucket.org/org-name/repo-id/src/master
|
|
105
144
|
# This value will work.
|
|
106
|
-
backstage
|
|
145
|
+
backstage.io/source-location: url:https://bitbucket.org/org-name/repo-id/src/master/
|
|
107
146
|
...
|
|
108
147
|
```
|
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import * as _backstage_plugin_catalog_react_alpha from '@backstage/plugin-catalog-react/alpha';
|
|
5
|
+
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Frontend plugin that fetches and displays the readme for an entity
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{}, {}, {
|
|
13
|
+
"api:readme": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
14
|
+
kind: "api";
|
|
15
|
+
name: undefined;
|
|
16
|
+
config: {};
|
|
17
|
+
configInput: {};
|
|
18
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
|
|
19
|
+
inputs: {};
|
|
20
|
+
params: <TApi, TImpl extends TApi, TDeps extends {
|
|
21
|
+
[x: string]: unknown;
|
|
22
|
+
}>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
|
|
23
|
+
}>;
|
|
24
|
+
"entity-card:readme": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
|
|
25
|
+
kind: "entity-card";
|
|
26
|
+
name: undefined;
|
|
27
|
+
config: {
|
|
28
|
+
filter: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
29
|
+
type: "summary" | "content" | "info" | undefined;
|
|
30
|
+
};
|
|
31
|
+
configInput: {
|
|
32
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
|
|
33
|
+
type?: "summary" | "content" | "info" | undefined;
|
|
34
|
+
};
|
|
35
|
+
output: _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
|
|
36
|
+
optional: true;
|
|
37
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
|
|
38
|
+
optional: true;
|
|
39
|
+
}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_plugin_catalog_react_alpha.EntityCardType, "catalog.entity-card-type", {
|
|
40
|
+
optional: true;
|
|
41
|
+
}>;
|
|
42
|
+
inputs: {};
|
|
43
|
+
params: {
|
|
44
|
+
loader: () => Promise<JSX.Element>;
|
|
45
|
+
filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
|
|
46
|
+
type?: _backstage_plugin_catalog_react_alpha.EntityCardType | undefined;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export { _default as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ApiBlueprint, identityApiRef, fetchApiRef, discoveryApiRef, createFrontendPlugin } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { readmeApiRef } from './api/ReadmeApi.esm.js';
|
|
4
|
+
import { ReadmeClient } from './api/ReadmeClient.esm.js';
|
|
5
|
+
import { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';
|
|
6
|
+
|
|
7
|
+
const readmeApi = ApiBlueprint.make({
|
|
8
|
+
params: (defineParams) => defineParams({
|
|
9
|
+
api: readmeApiRef,
|
|
10
|
+
deps: {
|
|
11
|
+
discoveryApi: discoveryApiRef,
|
|
12
|
+
fetchApi: fetchApiRef,
|
|
13
|
+
identityApi: identityApiRef
|
|
14
|
+
},
|
|
15
|
+
factory: ({ discoveryApi, fetchApi, identityApi }) => new ReadmeClient({ discoveryApi, fetchApi, identityApi })
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
const readmeCard = EntityCardBlueprint.make({
|
|
19
|
+
params: {
|
|
20
|
+
loader: async () => import('./components/ReadmeCard/index.esm.js').then((m) => /* @__PURE__ */ jsx(m.ReadmeCard, {}))
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
var alpha = createFrontendPlugin({
|
|
24
|
+
pluginId: "readme",
|
|
25
|
+
extensions: [readmeApi, readmeCard]
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { alpha as default };
|
|
29
|
+
//# sourceMappingURL=alpha.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/**\n * Frontend plugin that fetches and displays the readme for an entity\n *\n * @packageDocumentation\n */\n\nimport {\n ApiBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { readmeApiRef } from './api/ReadmeApi';\nimport { ReadmeClient } from './api/ReadmeClient';\nimport { EntityCardBlueprint } from '@backstage/plugin-catalog-react/alpha';\n\nconst readmeApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: readmeApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, fetchApi, identityApi }) =>\n new ReadmeClient({ discoveryApi, fetchApi, identityApi }),\n }),\n});\n\nconst readmeCard = EntityCardBlueprint.make({\n params: {\n loader: async () =>\n import('./components/ReadmeCard').then(m => <m.ReadmeCard />),\n },\n});\n\nexport default createFrontendPlugin({\n pluginId: 'readme',\n extensions: [readmeApi, readmeCard],\n});\n"],"names":[],"mappings":";;;;;;AAiBA,MAAM,SAAA,GAAY,aAAa,IAAK,CAAA;AAAA,EAClC,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,YAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,QAAU,EAAA,WAAA;AAAA,MACV,WAAa,EAAA;AAAA,KACf;AAAA,IACA,OAAS,EAAA,CAAC,EAAE,YAAA,EAAc,QAAU,EAAA,WAAA,EAClC,KAAA,IAAI,YAAa,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,aAAa;AAAA,GAC3D;AACL,CAAC,CAAA;AAED,MAAM,UAAA,GAAa,oBAAoB,IAAK,CAAA;AAAA,EAC1C,MAAQ,EAAA;AAAA,IACN,MAAA,EAAQ,YACN,OAAO,sCAAyB,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,qBAAM,GAAA,CAAA,CAAA,CAAE,UAAF,EAAA,EAAa,CAAE;AAAA;AAElE,CAAC,CAAA;AAED,YAAe,oBAAqB,CAAA;AAAA,EAClC,QAAU,EAAA,QAAA;AAAA,EACV,UAAA,EAAY,CAAC,SAAA,EAAW,UAAU;AACpC,CAAC,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axis-backstage/plugin-readme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"import": "./dist/index.esm.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"default": "./dist/index.esm.js"
|
|
9
|
+
},
|
|
10
|
+
"./alpha": {
|
|
11
|
+
"backstage": "@backstage/FrontendPlugin",
|
|
12
|
+
"import": "./dist/alpha.esm.js",
|
|
13
|
+
"types": "./dist/alpha.d.ts",
|
|
14
|
+
"default": "./dist/alpha.esm.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json"
|
|
17
|
+
},
|
|
4
18
|
"main": "dist/index.esm.js",
|
|
5
19
|
"types": "dist/index.d.ts",
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
"*": {
|
|
22
|
+
"alpha": [
|
|
23
|
+
"dist/alpha.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"package.json": [
|
|
26
|
+
"package.json"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
6
30
|
"license": "Apache-2.0",
|
|
7
31
|
"publishConfig": {
|
|
8
32
|
"access": "public",
|
|
@@ -16,7 +40,10 @@
|
|
|
16
40
|
"pluginPackages": [
|
|
17
41
|
"@axis-backstage/plugin-readme",
|
|
18
42
|
"@axis-backstage/plugin-readme-backend"
|
|
19
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"features": {
|
|
45
|
+
"./alpha": "@backstage/FrontendPlugin"
|
|
46
|
+
}
|
|
20
47
|
},
|
|
21
48
|
"sideEffects": false,
|
|
22
49
|
"scripts": {
|
|
@@ -29,12 +56,14 @@
|
|
|
29
56
|
"postpack": "backstage-cli package postpack"
|
|
30
57
|
},
|
|
31
58
|
"dependencies": {
|
|
32
|
-
"@backstage/catalog-model": "^1.7.
|
|
33
|
-
"@backstage/core-
|
|
34
|
-
"@backstage/core-
|
|
59
|
+
"@backstage/catalog-model": "^1.7.6",
|
|
60
|
+
"@backstage/core-compat-api": "^0.5.5",
|
|
61
|
+
"@backstage/core-components": "^0.18.4",
|
|
62
|
+
"@backstage/core-plugin-api": "^1.12.1",
|
|
35
63
|
"@backstage/errors": "^1.2.7",
|
|
36
|
-
"@backstage/plugin-
|
|
37
|
-
"@backstage/
|
|
64
|
+
"@backstage/frontend-plugin-api": "^0.13.2",
|
|
65
|
+
"@backstage/plugin-catalog-react": "^1.21.4",
|
|
66
|
+
"@backstage/theme": "^0.7.1",
|
|
38
67
|
"@mui/icons-material": "^5.15.7",
|
|
39
68
|
"@mui/material": "^5.15.7",
|
|
40
69
|
"react-use": "^17.2.4"
|
|
@@ -46,10 +75,10 @@
|
|
|
46
75
|
"react-router-dom": "^6.3.0"
|
|
47
76
|
},
|
|
48
77
|
"devDependencies": {
|
|
49
|
-
"@backstage/cli": "^0.
|
|
50
|
-
"@backstage/core-app-api": "^1.
|
|
51
|
-
"@backstage/dev-utils": "^1.1.
|
|
52
|
-
"@backstage/test-utils": "^1.7.
|
|
78
|
+
"@backstage/cli": "^0.35.1",
|
|
79
|
+
"@backstage/core-app-api": "^1.19.3",
|
|
80
|
+
"@backstage/dev-utils": "^1.1.18",
|
|
81
|
+
"@backstage/test-utils": "^1.7.14",
|
|
53
82
|
"@testing-library/dom": "^10.0.0",
|
|
54
83
|
"@testing-library/jest-dom": "^6.0.0",
|
|
55
84
|
"@testing-library/react": "^16.0.0",
|
|
@@ -59,13 +88,6 @@
|
|
|
59
88
|
"files": [
|
|
60
89
|
"dist"
|
|
61
90
|
],
|
|
62
|
-
"typesVersions": {
|
|
63
|
-
"*": {
|
|
64
|
-
"package.json": [
|
|
65
|
-
"package.json"
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
91
|
"module": "./dist/index.esm.js",
|
|
70
92
|
"directory": "_release/package"
|
|
71
93
|
}
|