|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * assemblies/assembly-techdocs-addons-installing.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="proc-techdocs-addon-install-third-party_{context}"] |
| 7 | +== Installing and configuring a third-party TechDocs add-on |
| 8 | + |
| 9 | +You can install compatible third-party TechDocs add-on on your {product} instance as a front-end dynamic plugin. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | +* The third-party TechDocs add-on has a valid `package.json` file in its root directory, containing all required metadata and dependencies. |
| 13 | +* You have installed the @janus-idp/cli package. |
| 14 | +* You have installed and configured Node.js and NPM. |
| 15 | +* You have installed the `scalprum` CLI tool for configuring front-end plugins. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | +. Obtain the source code for the third-party TechDocs add-on that you want to use. |
| 19 | +. Export the TechDocs add-on as a dynamic plugin using the following command: |
| 20 | ++ |
| 21 | +[source,terminal,subs="+quotes,+attributes"] |
| 22 | +---- |
| 23 | +npx @janus-idp/cli@latest package export-dynamic-plugin |
| 24 | +---- |
| 25 | ++ |
| 26 | +[NOTE] |
| 27 | +==== |
| 28 | +The `@latest` tag uses the latest version of the `package.json` file for compatibility with the most recent features and fixes. |
| 29 | +==== |
| 30 | ++ |
| 31 | +.Example output |
| 32 | +[source,terminal,subs="+quotes,+attributes"] |
| 33 | +---- |
| 34 | +Using scalpum config inlined in the `package.json` |
| 35 | +Packing main package to dist-dynamic/package.json |
| 36 | +Customizing main package in dist-dynamic/package.json for dynamic loading |
| 37 | +Generating dynamic frontend plugin assets in _<path_to_add-on_package>_/_<third-party_add-on_package>_/dist-dynamic/dist-scalprum |
| 38 | +... |
| 39 | +---- |
| 40 | ++ |
| 41 | +where |
| 42 | + |
| 43 | +_<path_to_add-on_package>_ :: Specifies the package for the third-party add-on that you want to export, for example, `backstage-plugin-techdocs-module-addon-mermaid`. |
| 44 | + |
| 45 | +. To package the third-party TechDocs add-on as a dynamic plugin, navigate to the root directory where the plugin is stored (not the dist-dynamic directory) and run the `npx` command with the `--tag` option to specify the image name and tag. For example: |
| 46 | ++ |
| 47 | +[source,terminal,subs="+quotes,+attributes"] |
| 48 | +---- |
| 49 | +npx @janus-idp/cli@latest package package-dynamic-plugins --tag quay.io/_<user_name>_/_<techdocs_add-on_image>_:latest |
| 50 | +---- |
| 51 | ++ |
| 52 | +[NOTE] |
| 53 | +==== |
| 54 | +The output of the package-dynamic-plugins command provides the file path to the plugin for use in the `dynamic-plugin-config.yaml` file. |
| 55 | +==== |
| 56 | ++ |
| 57 | +. To publish the third-party TechDocs add-on to a Quay repository, push the image to a registry using one of the following commands, depending on your virtualization tool: |
| 58 | +* To use `podman`, enter the following command: |
| 59 | ++ |
| 60 | +[source,terminal,subs="+quotes,+attributes"] |
| 61 | +---- |
| 62 | +podman push quay.io/_<user_name>_/_<techdocs_add-on_image>_:latest |
| 63 | +---- |
| 64 | +* To use `docker`, enter the following command: |
| 65 | ++ |
| 66 | +[source,terminal,subs="+quotes,+attributes"] |
| 67 | +---- |
| 68 | +docker push quay.io/_<user_name>_/_<techdocs_add-on_image>_:latest |
| 69 | +---- |
| 70 | +. Open your `dynamic-plugins.yaml` file to view or modify the configuration for the third-party TechDocs add-on. For example: |
| 71 | ++ |
| 72 | +[source,yaml,subs="+quotes,+attributes"] |
| 73 | +---- |
| 74 | +plugins: |
| 75 | + - package: oci://quay.io/_<user_name>_/_<techdocs_add-on_image>_:latest!_<techdocs_add-on_package>_ |
| 76 | + disabled: false |
| 77 | + pluginConfig: |
| 78 | + dynamicPlugins: |
| 79 | + frontend: |
| 80 | + _<techdocs_add-on_package>_ |
| 81 | + techdocsAddons: |
| 82 | + - importName: _<third-party_add-on_name>_ |
| 83 | + config: |
| 84 | + props: |
| 85 | + config: |
| 86 | + theme: _<theme_name>_ |
| 87 | + themeVariables: { lineColor: "_<line_color_variable>_"} |
| 88 | +---- |
| 89 | ++ |
| 90 | +where |
| 91 | +
|
| 92 | +_<user_name>>_ :: Specifies your Quay user name or organization name. |
| 93 | +_<techdocs_add-on_image>_ :: Specifies the name of the image for the third-party add-on that you want to use, for example, `mermaid`. |
| 94 | +_<techdocs_add-on_package>_ :: Specifies the , for example, `backstage-plugin-techdocs-addon-mermaid`. |
| 95 | +_<third-party_add-on_name>_ :: Specifies the name of the third-party add-on that you want to use, for example, `Mermaid`. |
| 96 | +_<theme_name>_ :: Specifies the name of the visual theme that you want to apply to your third-party TechDocs add-on, for example, `forest`. Depending on the third-party add-on, this field can be optional or required. |
| 97 | +_<line_color_variable>_ :: Specifies the line color that you want to use in the visual theme, for example, #000000. Depending on the third-party add-on, this field can be optional or required. |
| 98 | + |
| 99 | +.Additional resources |
| 100 | +* link:https://docs.redhat.com/en/documentation/red_hat_developer_hub/1.4/html/installing_and_viewing_plugins_in_red_hat_developer_hub/assembly-third-party-plugins#assembly-third-party-plugins[Third-party plugins in {product}] |
0 commit comments