Skip to content

fix: add missing backstage.features filed for standard Module federation assets#136

Merged
davidfestal merged 5 commits into
mainfrom
add-backstage-features-to-dynamic-plugin
Jul 20, 2026
Merged

fix: add missing backstage.features filed for standard Module federation assets#136
davidfestal merged 5 commits into
mainfrom
add-backstage-features-to-dynamic-plugin

Conversation

@davidfestal

Copy link
Copy Markdown
Member

Summary

Implements RHIDP-15376.

Upstream Backstage's backstage-cli pack now populates backstage.features in package.json by analyzing each entry point's default export $$type via ts-morph. Since rhdh-cli's forked productionPack predates that addition, this PR adds the same detection as a separate step during frontend dynamic plugin export.

When --generate-module-federation-assets is enabled (the default), the export command now:

  • Creates a ts-morph project and reads the package's entry points
  • Detects the Backstage feature type for each entry point (e.g. @backstage/FrontendPlugin)
  • Writes the detected features into backstage.features in the output package.json

Changes

  • New: src/commands/export-dynamic-plugin/features.tsdetectBackstageFeatures() utility mirroring upstream's detection logic
  • Modified: src/commands/export-dynamic-plugin/frontend.ts — integrates feature detection and injects results via the after callback of customizeForDynamicUse()
  • Modified: scripts/backstage-types-config.json — added type extraction config for typeDistProject and entryPoints modules
  • Regenerated: src/generated/backstage-cli-types.d.ts — now includes type declarations for the new internal modules
  • Modified: package.json — added ts-morph as a peer dependency (provided transitively by @backstage/cli-module-build)
  • Modified: E2E tests — added assertions verifying backstage.features is populated for frontend plugins

Test plan

  • Manual verification: rhdh-cli plugin export-dynamic on a frontend plugin produces backstage.features with correct feature types
  • E2E tests pass with new backstage.features assertions
  • yarn tsc passes

…ation assets

Assisted-by: Cursor
Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>

Signed-off-by: David Festal <dfestal@redhat.com>
Signed-off-by: David Festal <dfestal@redhat.com>
@davidfestal
davidfestal force-pushed the add-backstage-features-to-dynamic-plugin branch from 426b6f3 to 0956f21 Compare July 20, 2026 13:28
@sonarqubecloud

Copy link
Copy Markdown

@davidfestal
davidfestal merged commit 067fe18 into main Jul 20, 2026
6 checks passed
@davidfestal
davidfestal deleted the add-backstage-features-to-dynamic-plugin branch July 20, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants