@axis-backstage/plugin-readme 0.16.0 → 0.17.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @axis-backstage/plugin-readme
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 798d14d: Added support for new frontend system
8
+
3
9
  ## 0.16.0
4
10
 
5
11
  ### Minor Changes
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 extentions such as README.md, README.MD, README.txt, README, and README.rst.
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.
@@ -0,0 +1,52 @@
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
+ import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
7
+
8
+ /**
9
+ * Frontend plugin that fetches and displays the readme for an entity
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin<{}, {}, {
14
+ "api:readme": _backstage_frontend_plugin_api.ExtensionDefinition<{
15
+ kind: "api";
16
+ name: undefined;
17
+ config: {};
18
+ configInput: {};
19
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_core_plugin_api.AnyApiFactory, "core.api.factory", {}>;
20
+ inputs: {};
21
+ params: <TApi, TImpl extends TApi, TDeps extends {
22
+ [x: string]: unknown;
23
+ }>(params: _backstage_core_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_core_plugin_api.AnyApiFactory>;
24
+ }>;
25
+ "entity-card:readme": _backstage_frontend_plugin_api.ExtensionDefinition<{
26
+ kind: "entity-card";
27
+ name: undefined;
28
+ config: {
29
+ filter: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
30
+ type: "summary" | "content" | "info" | undefined;
31
+ };
32
+ configInput: {
33
+ filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | undefined;
34
+ type?: "summary" | "content" | "info" | undefined;
35
+ };
36
+ 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", {
37
+ optional: true;
38
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
39
+ optional: true;
40
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_plugin_catalog_react_alpha.EntityCardType, "catalog.entity-card-type", {
41
+ optional: true;
42
+ }>;
43
+ inputs: {};
44
+ params: {
45
+ loader: () => Promise<JSX.Element>;
46
+ filter?: _backstage_plugin_catalog_react_alpha.EntityPredicate | ((entity: _backstage_catalog_model.Entity) => boolean) | undefined;
47
+ type?: _backstage_plugin_catalog_react_alpha.EntityCardType | undefined;
48
+ };
49
+ }>;
50
+ }>;
51
+
52
+ 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.16.0",
3
+ "version": "0.17.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": {
@@ -30,9 +57,11 @@
30
57
  },
31
58
  "dependencies": {
32
59
  "@backstage/catalog-model": "^1.7.5",
60
+ "@backstage/core-compat-api": "^0.5.1",
33
61
  "@backstage/core-components": "^0.17.5",
34
62
  "@backstage/core-plugin-api": "^1.10.9",
35
63
  "@backstage/errors": "^1.2.7",
64
+ "@backstage/frontend-plugin-api": "^0.11.0",
36
65
  "@backstage/plugin-catalog-react": "^1.20.1",
37
66
  "@backstage/theme": "^0.6.8",
38
67
  "@mui/icons-material": "^5.15.7",
@@ -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
  }