Migrating Backstage plugins to Cortex
Last updated
Was this helpful?
Last updated
Was this helpful?
This guide covers how to migrate Backstage plugins to Cortex.
Follow the steps in Cortex's documentation to create a Cortex plugin code repository.
In the repository, copy/paste (and merge, when appropriate) the Backstage source code into src/
.
Favor the Cortex code if you encounter any conflicts.
Replace the Backstage eslint
config with the Cortex config.
Note: Later in this process, you will need to run eslint src --fix
and may have to manually fix some lint settings.
Delete the remaining Backstage registration files, such as plugin.ts
and index.ts
.
Do not delete routes.ts
as that will be removed in a later step.
Remove all @backstage/
package dependencies (except for @backstage/core-components
) then iterate over them by running a command similar to the following: yarn remove @backstage/package-name @backstage/package-name-2
.
react-router
In this step, you will switch to using react-router
directly instead of through the Backstage abstraction.
Replace Backstage route usage with react-router/react-router-dom
.
Use `` from react-router-dom
for the provider.
Remove routes.ts
.
Replace Backstage API refs with simple classes or objects.
Use fetch()
directly instead of Backstage’s useApi
.
Remove errorApi
usage (Cortex has no equivalent).
Additional testing is recommended, as there will likely be some final clean-ups to ensure everything is working as expected.
Note that there is no complete 1:1 mapping between the two data models. You will likely need to fetch additional data from the as needed.