You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/dynamic-plugins/proc-export-third-party-plugins-rhdh.adoc
+24-26Lines changed: 24 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,17 +3,23 @@
3
3
4
4
To use plugins in {product}, you can export plugins as derived dynamic plugin packages. These packages contain the plugin code and dependencies, ready for dynamic plugin integration into {product-short}.
5
5
6
-
Backend plugins::
6
+
.Prerequisites
7
+
* The `@janus-idp/cli` package is installed. Use the latest version (`@latest` tag) for compatibility with the most recent features and fixes.
8
+
* Node.js and NPM is installed and configured.
9
+
* The third-party plugin is compatible with your {product} version. For more information, see link:https://github.com/janus-idp/backstage-showcase/blob/main/docs/dynamic-plugins/versions.md[Version compatibility matrix].
10
+
* The third-party plugin must have a valid `package.json` file in its root directory, containing all required metadata and dependencies.
7
11
+
8
12
--
9
-
To ensure compatibility with the dynamic plugin support and enable their use as dynamic plugins, existing backend plugins must be compatible with the backend system. Additionally, these plugins must be rebuilt using a dedicated CLI command.
10
-
11
-
The backend system entry point (created using `createBackendPlugin()` or `createBackendModule()`) must be exported as the default export from either the main package or an `alpha` package (if the plugin instance support is still provided using `alpha` APIs). This doesn't add any additional requirement on top of the standard plugin development guidelines of the plugin instance.
12
-
13
+
Backend plugins::
14
+
+
15
+
To ensure compatibility with the dynamic plugin support and enable their use as dynamic plugins, existing backend plugins must be compatible with the new Backstage backend system. Additionally, these plugins must be rebuilt using a dedicated CLI command.
16
+
+
17
+
The new Backstage backend system entry point (created using `createBackendPlugin()` or `createBackendModule()`) must be exported as the default export from either the main package or an `alpha` package (if the plugin instance support is still provided using `alpha` APIs). This doesn't add any additional requirement on top of the standard plugin development guidelines of the plugin instance.
18
+
+
13
19
The dynamic export mechanism identifies private dependencies and sets the `bundleDependencies` field in the `package.json` file. This export mechanism ensures that the dynamic plugin package is published as a self-contained package, with its private dependencies bundled in a private `node_modules` folder.
14
-
20
+
+
15
21
Certain plugin dependencies require specific handling in the derived packages, such as:
16
-
22
+
+
17
23
* *Shared dependencies* are provided by the {product-very-short} application and listed as `peerDependencies` in `package.json` file, not bundled in the dynamic plugin package. For example, by default, all `@backstage` scoped packages are shared.
18
24
+
19
25
You can use the `--shared-package` flag to specify shared dependencies, that are expected to be provided by {product} application and not bundled in the dynamic plugin package.
@@ -23,32 +29,30 @@ To treat a `@backstage` package as private, use the negation prefix (`!`). For e
23
29
* *Embedded dependencies* are bundled into the dynamic plugin package with their dependencies hoisted to the top level. By default, packages with `-node` or `-common` suffixes are embedded.
24
30
+
25
31
You can use the `--embed-package` flag to specify additional embedded packages. For example, packages from the same workspace that do not follow the default naming convention.
26
-
32
+
+
27
33
The following is an example of exporting a dynamic plugin with shared and embedded packages:
28
-
34
+
+
29
35
.Example dynamic plugin export with shared and embedded packages
<1> `@backstage/plugin-notifications` package is treated as a private dependency and is bundled in the dynamic plugin package, despite being in the `@backstage` scope.
36
42
<2> `@backstage/plugin-notifications-backend` package is marked as an embedded dependency and is bundled in the dynamic plugin package.
37
-
--
38
43
39
44
Front-end plugins::
40
45
+
41
-
--
42
46
Front-end plugins can use `scalprum` for configuration, which the CLI can generate automatically during the export process. The generated default configuration is logged when running the following command:
43
-
47
+
+
44
48
.Example command to log the default configuration
45
49
[source,bash]
46
50
----
47
51
npx @janus-idp/cli@latest export-dynamic
48
52
----
49
-
53
+
+
50
54
The following is an example of default `scalprum` configuration:
51
-
55
+
+
52
56
.Default `scalprum` configuration
53
57
[source,json]
54
58
----
@@ -59,9 +63,9 @@ The following is an example of default `scalprum` configuration:
59
63
}
60
64
}
61
65
----
62
-
66
+
+
63
67
You can add a `scalprum` section to the `package.json` file. For example:
64
-
68
+
+
65
69
.Example `scalprum` customization
66
70
[source,json]
67
71
----
@@ -74,11 +78,11 @@ You can add a `scalprum` section to the `package.json` file. For example:
74
78
}
75
79
}
76
80
----
77
-
81
+
+
78
82
Dynamic plugins might need adjustments for {product-short} needs, such as static JSX for mountpoints or dynamic routes. These changes are optional but might be incompatible with static plugins.
79
-
83
+
+
80
84
To include static JSX, define an additional export and use it as the dynamic plugin's `importName`. For example:
* The `@janus-idp/cli` package is installed. Use the latest version (`@latest` tag) for compatibility with the most recent features and fixes.
102
-
* The third-party plugin must have a valid package.json file in its root directory, containing all required metadata and dependencies.
103
-
* Node.js and NPM is installed and configured.
104
-
* The third-party plugin is compatible with your {product} version. For more information, see link:https://github.com/janus-idp/backstage-showcase/blob/main/docs/dynamic-plugins/versions.md[Version compatibility matrix].
105
-
106
104
.Procedure
107
105
* Use the `package export-dynamic-plugin` command from the `@janus-idp/cli` package to export the plugin:
0 commit comments