🔧 Repository: `backstage-cli repo fix --publish` guesses wrong when no `backstage.pluginId` or `pluginPackage` set in package.json
📜 Description
I'm using the cli command .../node_modules/@backstage/cli/bin/backstage-cli repo fix --publish (version 0.26.11)
Seems like it's always using this for workspaces in the community plugins repo:
"pluginId": "catalog",
"pluginPackage": "@backstage/plugin-catalog-backend"
instead of
"pluginId": "scaffolder-relation-processor",
"pluginPackage": "@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor"
ref: https://github.com/backstage/community-plugins/pull/851
Yet when I run this in another repo, I get:
Error: Failed to guess plugin ID for "plugin-catalog-backend-module-scaffolder-relation-processor", please set the 'backstage.pluginId' field manually in "dynamic-plugins/wrappers/plugin-catalog-backend-module-scaffolder-relation-processor/package.json"
If I set the ID ...
"pluginId": "plugin-catalog-backend-module-scaffolder-relation-processor"
... I get ...
"pluginId": "plugin-catalog-backend-module-scaffolder-relation-processor",
"pluginPackages": [
"plugin-catalog-backend-module-scaffolder-relation-processor"
]
So that seems to be working.
How does it compute the correct values to use when run in a community plugins workspace?
👍 Expected behavior
repo fix --publish should not change the pluginId to catalog if missing.
👎 Current Behavior
See above
👟 Reproduction steps
- check out repo https://github.com/backstage/community-plugins/
- edit
workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor/package.jsonto remove the values ofbackstage.pluginIdandbackstage.pluginPackage- it'll look like this:
"backstage": {
"role": "backend-plugin-module"
},
-
run
../../node_modules/@backstage/cli/bin/backstage-cli repo fix --publish . -
note that the
backstage.pluginIdandbackstage.pluginPackageare now reusing the same pluginId =catalogand an incorrectpluginPackage:
"backstage": {
"role": "backend-plugin-module",
"pluginId": "catalog",
"pluginPackage": "@backstage/plugin-catalog-backend"
},
📃 Provide the context for the Bug.
similar issue in https://github.com/backstage/community-plugins/issues/624 but this is more about the content being generated than the need to run the command to generate it.
I've also opened PR https://github.com/backstage/community-plugins/pull/851 to fix the incorrect metadata (by hand, as the cli won't do this for me)
👀 Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
Are you willing to submit PR?
Yes I am willing to submit a PR!