Skip to main content

Generate Package Metadata

If you have packages added to your Portal instance with missing or incomplete metadata, and you are the owner of the package, you can use backstage tooling to generate valid metadata for the package.

npx @backstage/cli repo fix --publish

To make sure the metadata is generated as part of publishing your package you can add a new script to your package.json. Update your root package.json in your workspace with the following script to make sure metadata gets generated. Make sure to run the repo:fix command before publishing your Backstage package.

{
"scripts": {
"repo:fix": "backstage-cli repo fix --publish"
}
}

When you generate metadata for your package, review what it generates to make sure pluginIds and other types of the metadata makes sense. The CLI is trying to guess things based on package name and role of the package. If it gets anything wrong you can update the field manually in the package.json Note: There are some inconsistencies that it might reject but it'll give you some more info in that case.