Skip to content

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

Open
davidfestal wants to merge 6 commits into
mainfrom
add-backstage-features-to-dynamic-plugin
Open

fix: add missing backstage.features filed for standard Module federation assets#136
davidfestal wants to merge 6 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>
- Documented the addition of the missing `backstage.features` field in generated `dist-dynamic/package.json` files for standard Module Federation asset generation.

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>
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

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.

2 participants