Skip to content

frontend-dev-utils: add helper for plugin dev apps - #33368

Merged
Rugvip merged 14 commits into
masterfrom
rugvip/add-frontend-dev-utils
Mar 16, 2026
Merged

Rugvip merged 14 commits into
masterfrom
rugvip/add-frontend-dev-utils

Conversation

@Rugvip

@Rugvip Rugvip commented Mar 16, 2026 •

Copy link
Copy Markdown
Member

Hey, I just made a Pull Request!

Draft for now while awaiting feedback.

This adds @backstage/frontend-dev-utils as a small helper for wiring up NFS plugin dev apps, keeps the createDevApp API intentionally small with features and bindRoutes, and fixes a PluginHeader resize-observer warning that showed up in the dev app when used together with FullPage.

The helper now also follows the same render-path split as @backstage/dev-utils, so it works with both React 17 and 18 setups and gives a clearer error if the dev entry HTML is missing #root.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@backstage-goalie

backstage-goalie Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/cli-module-new packages/cli-module-new patch v0.0.0
@backstage/cli packages/cli patch v0.36.0-next.2
@backstage/frontend-dev-utils packages/frontend-dev-utils minor v0.0.0
@backstage/ui packages/ui patch v0.13.0-next.2
@backstage/plugin-app-visualizer plugins/app-visualizer patch v0.2.1-next.2

@backstage-goalie backstage-goalie Bot added size:medium Medium-sized pull requests receive no change in priority for reviews. waiting-for:review The PR needs a review and will be visible in the review queue unless already assigned an owner. labels Mar 16, 2026
@github-actions github-actions Bot added the area:documentation Improvements or additions to documentation label Mar 16, 2026
@Rugvip
Rugvip force-pushed the rugvip/add-frontend-dev-utils branch 2 times, most recently from 25f2369 to 16133e9 Compare March 16, 2026 11:50
@Rugvip
Rugvip marked this pull request as ready for review March 16, 2026 12:16
@Rugvip
Rugvip requested review from a team and backstage-service as code owners March 16, 2026 12:16
Copilot AI review requested due to automatic review settings March 16, 2026 12:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new @backstage/frontend-dev-utils package to simplify spinning up isolated dev apps for plugins built on the new frontend system, and updates documentation and an example plugin to use it.

Changes:

  • Introduces @backstage/frontend-dev-utils with a createDevApp helper that wraps createApp and renders into #root.
  • Updates @backstage/plugin-app-visualizer dev entry point to use createDevApp.
  • Documents the recommended dev/index.ts setup for the new frontend system and updates project structure docs.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/frontend-dev-utils/src/createDevApp.tsx Implements the createDevApp helper and sign-in bypass behavior.
packages/frontend-dev-utils/package.json Adds the new package and its dependency/peerDependency setup.
packages/frontend-dev-utils/src/index.ts Exports the new public API surface.
packages/frontend-dev-utils/src/createDevApp.test.tsx Adds a basic rendering test for the helper.
packages/frontend-dev-utils/report.api.md API extractor report for the new package.
packages/frontend-dev-utils/README.md Package README for consumers.
packages/frontend-dev-utils/catalog-info.yaml Catalog metadata for the new package.
packages/frontend-dev-utils/.eslintrc.js Standard package eslint config bootstrap.
packages/frontend-dev-utils/knip-report.md Knip report placeholder for the package.
plugins/app-visualizer/dev/index.ts Switches dev bootstrap to createDevApp.
plugins/app-visualizer/package.json Updates devDependency to use @backstage/frontend-dev-utils.
docs/tooling/cli/02-build-system.md Documents createDevApp for plugin dev entry points.
docs/frontend-system/building-plugins/01-index.md Adds guidance on running a dev server using createDevApp.
docs/contribute/project-structure.md Adds frontend-dev-utils/ to the project structure docs.
.changeset/add-frontend-dev-utils.md Changeset for the new package.
.changeset/app-visualizer-use-frontend-dev-utils.md Changeset for the app-visualizer dev entry update.
scripts/verify-local-dependencies.js Allows the new package within local dependency verification rules.
yarn.lock Lockfile updates for the new workspace package and dependency changes.

@backstage-goalie backstage-goalie Bot added waiting-for:author Changes have been requested and the PR will not receive a review until the changes are made. and removed waiting-for:review The PR needs a review and will be visible in the review queue unless already assigned an owner. labels Mar 16, 2026
@Rugvip
Rugvip requested a review from a team as a code owner March 16, 2026 14:06
@Rugvip Rugvip changed the title frontend-dev-utils: add new package for NFS dev setup frontend-dev-utils: add helper for plugin dev apps Mar 16, 2026
@Rugvip
Rugvip marked this pull request as draft March 16, 2026 14:07
@backstage-goalie backstage-goalie Bot added waiting-for:review The PR needs a review and will be visible in the review queue unless already assigned an owner. and removed waiting-for:author Changes have been requested and the PR will not receive a review until the changes are made. labels Mar 16, 2026
@github-actions

github-actions Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Visual Testing with Chromatic

Rugvip added 4 commits March 16, 2026 16:10
Adds a new `@backstage/frontend-dev-utils` package for the new frontend
system. It provides a minimal `createDevApp` helper for wiring up a
development app from a `dev/` entry point.

The app-visualizer plugin is updated to use this new package as the
initial testing ground.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
Add documentation for the new `@backstage/frontend-dev-utils` package
across three docs pages: the frontend system building plugins guide,
the CLI build system reference, and the project structure overview.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
The dev app now automatically disables the sign-in page extension,
so plugins under development don't require authentication.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
Add @backstage/frontend-dev-utils to the except list for the rule
that prevents web-library packages from depending on frontend-plugin
packages, since it legitimately wraps @backstage/plugin-app for
development environments.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new @backstage/frontend-dev-utils package to simplify creating minimal dev apps for the new frontend system, updates templates/examples to use it, and fixes a PluginHeader ResizeObserver warning.

Changes:

  • Introduced @backstage/frontend-dev-utils with createDevApp (+ docs, API report, tests).
  • Updated new-frontend-plugin template and app-visualizer dev entrypoints to use createDevApp.
  • Updated PluginHeader to avoid ResizeObserver loop warnings via rAF scheduling and height deduping.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
yarn.lock Adds workspace lock entries for the new frontend dev utils package and adjusts dependencies.
scripts/verify-local-dependencies.js Allows the new package in local dependency verification rules.
plugins/app-visualizer/package.json Switches dev dependency from frontend-defaults to frontend-dev-utils.
plugins/app-visualizer/dev/index.ts Uses createDevApp instead of manually creating/rendering an app.
packages/ui/src/components/PluginHeader/PluginHeader.tsx Defers and dedupes header-height updates to avoid ResizeObserver loop warnings.
packages/frontend-dev-utils/src/index.ts Exports the new createDevApp API.
packages/frontend-dev-utils/src/createDevApp.tsx Implements createDevApp helper (app creation + render + CSS load + sign-in disable).
packages/frontend-dev-utils/src/createDevApp.test.tsx Adds a smoke test ensuring a plugin page renders in the dev app.
packages/frontend-dev-utils/src/BuiCss.tsx Lazy-loadable component that imports @backstage/ui CSS.
packages/frontend-dev-utils/report.api.md API Extractor report for the new exported API.
packages/frontend-dev-utils/package.json Declares the new package, deps/peers, and build/test scripts.
packages/frontend-dev-utils/knip-report.md Adds knip report placeholder file for the new package.
packages/frontend-dev-utils/catalog-info.yaml Registers the new package in the Backstage catalog.
packages/frontend-dev-utils/README.md Adds basic install/intro documentation for the new helper.
packages/frontend-dev-utils/.eslintrc.js Enables standard Backstage ESLint config for the new package.
packages/cli/templates/new-frontend-plugin/package.json.hbs Updates template devDependencies to include frontend-dev-utils.
packages/cli/templates/new-frontend-plugin/dev/index.tsx Updates template dev entry point to call createDevApp.
packages/cli-module-new/src/lib/version.ts Adds @backstage/frontend-dev-utils to version provider mapping.
packages/cli-module-new/src/lib/version.test.ts Adds coverage for the new version provider entry.
docs/tooling/cli/02-build-system.md Documents createDevApp as the recommended dev entrypoint for new frontend plugins.
docs/frontend-system/building-plugins/01-index.md Adds “Running a dev server” section using createDevApp.
docs/contribute/project-structure.md Documents frontend-dev-utils/ in project structure overview.
.changeset/new-frontend-plugin-template-dev-utils.md Announces template update to use frontend-dev-utils.
.changeset/fix-plugin-header-resizeobserver-loop.md Announces PluginHeader ResizeObserver loop fix.
.changeset/app-visualizer-use-frontend-dev-utils.md Announces app-visualizer dev entrypoint switch.
.changeset/add-frontend-dev-utils.md Announces new @backstage/frontend-dev-utils package.

Align the dev app render path with the existing dev-utils helper, add a clearer missing-root error, and extend the tests to cover bindRoutes forwarding and env cleanup.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
@backstage-goalie backstage-goalie Bot added size:large Large pull requests receive a slightly lower priority for reviews. and removed size:medium Medium-sized pull requests receive no change in priority for reviews. labels Mar 16, 2026
@Rugvip
Rugvip marked this pull request as draft March 16, 2026 17:56
@Rugvip
Rugvip marked this pull request as ready for review March 16, 2026 17:58
Copilot AI review requested due to automatic review settings March 16, 2026 17:58
@Rugvip
Rugvip enabled auto-merge March 16, 2026 17:59
@Rugvip
Rugvip disabled auto-merge March 16, 2026 17:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new @backstage/frontend-dev-utils package to standardize wiring of dev apps for the new frontend system, updates templates/docs to use it, and tweaks PluginHeader height syncing to avoid ResizeObserver loop warnings in reactive layouts.

Changes:

  • Introduce @backstage/frontend-dev-utils with createDevApp({ features, bindRoutes }), including React 17/18 render-path split and clearer missing-#root error.
  • Switch dev entrypoints (template + app-visualizer) to use createDevApp, and document the recommended pattern.
  • Update PluginHeader height propagation to reduce ResizeObserver loop warnings.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
yarn.lock Adds workspace entry for @backstage/frontend-dev-utils and updates app-visualizer deps.
scripts/verify-local-dependencies.js Allows @backstage/frontend-dev-utils in the relevant dependency exception list.
plugins/app-visualizer/package.json Replaces @backstage/frontend-defaults devDependency with @backstage/frontend-dev-utils.
plugins/app-visualizer/dev/index.ts Uses createDevApp instead of manual createApp + ReactDOM root wiring.
packages/ui/src/components/PluginHeader/PluginHeader.tsx Adjusts header height update scheduling to avoid ResizeObserver loop warnings.
packages/frontend-dev-utils/src/index.ts Public entrypoint exporting createDevApp and its options type.
packages/frontend-dev-utils/src/createDevApp.tsx Implements the dev app helper (feature wiring, root lookup, React 17/18 rendering).
packages/frontend-dev-utils/src/createDevApp.test.tsx Adds tests for rendering, bindRoutes forwarding, missing #root, and legacy render fallback.
packages/frontend-dev-utils/src/BuiCss.tsx Lazy-load wrapper for ensuring BUI CSS is loaded in dev apps.
packages/frontend-dev-utils/report.api.md API extractor report for the new package.
packages/frontend-dev-utils/package.json New package definition, deps/peers, and build/test scripts.
packages/frontend-dev-utils/knip-report.md Knip report placeholder for the new package.
packages/frontend-dev-utils/catalog-info.yaml Catalog metadata for the new package.
packages/frontend-dev-utils/README.md Basic package README and installation instructions.
packages/frontend-dev-utils/.eslintrc.js Standard ESLint config factory hook for the new package.
packages/cli/templates/new-frontend-plugin/package.json.hbs Template now includes @backstage/frontend-dev-utils devDependency.
packages/cli/templates/new-frontend-plugin/dev/index.tsx Template dev entrypoint now calls createDevApp.
packages/cli-module-new/src/lib/version.ts Adds @backstage/frontend-dev-utils to version provider map.
packages/cli-module-new/src/lib/version.test.ts Verifies version provider includes @backstage/frontend-dev-utils.
docs/tooling/cli/02-build-system.md Documents createDevApp as the recommended new-frontend dev entrypoint helper.
docs/frontend-system/building-plugins/01-index.md Adds “Running a dev server” section using @backstage/frontend-dev-utils.
docs/contribute/project-structure.md Documents frontend-dev-utils/ alongside dev-utils/.
.changeset/new-frontend-plugin-template-dev-utils.md Changeset for template + CLI version mapping update.
.changeset/fix-plugin-header-resizeobserver-loop.md Changeset for @backstage/ui PluginHeader warning fix.
.changeset/app-visualizer-use-frontend-dev-utils.md Changeset for app-visualizer dev entrypoint update.
.changeset/add-frontend-dev-utils.md Changeset introducing @backstage/frontend-dev-utils.

Rugvip added 2 commits March 16, 2026 19:03
Use definite assignment assertions for variables assigned inside
jest.isolateModules callbacks.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
Only suspend the lazy BUI CSS import so the app root keeps its built-in loading UI, and lock that behavior down in the mocked render test.

Signed-off-by: Patrik Oldsberg <[email protected]>
Made-with: Cursor
Copilot AI review requested due to automatic review settings March 16, 2026 18:10
@Rugvip
Rugvip marked this pull request as draft March 16, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new @backstage/frontend-dev-utils package to standardize and simplify dev app wiring for plugins using the new frontend system, updates templates/docs to recommend it, and adjusts PluginHeader to avoid ResizeObserver loop warnings in reactive layouts.

Changes:

  • Added @backstage/frontend-dev-utils with a minimal createDevApp({ features, bindRoutes }) helper, including React 17/18 render-path support, lazy BUI CSS loading, and clearer #root errors.
  • Updated built-in examples and the new frontend plugin template to use createDevApp instead of manually wiring createApp + ReactDOM rendering.
  • Fixed PluginHeader height updates to reduce ResizeObserver loop warnings by scheduling updates via requestAnimationFrame and avoiding redundant CSS var writes.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
yarn.lock Adds workspace entry for @backstage/frontend-dev-utils and updates dependent resolution.
scripts/verify-local-dependencies.js Allows @backstage/frontend-dev-utils as an exception for frontend-role → frontend-plugin dependency rules.
plugins/app-visualizer/package.json Switches dev dependency from frontend-defaults to frontend-dev-utils.
plugins/app-visualizer/dev/index.ts Replaces manual dev app wiring with createDevApp.
packages/ui/src/components/PluginHeader/PluginHeader.tsx Debounces header-height CSS var updates to avoid ResizeObserver loop warnings.
packages/frontend-dev-utils/src/index.ts Public entrypoint exporting createDevApp and options type.
packages/frontend-dev-utils/src/createDevApp.tsx Implements the dev app helper (features + optional bindRoutes) with React 17/18 rendering split and lazy BUI CSS loading.
packages/frontend-dev-utils/src/createDevApp.test.tsx Adds tests for render behavior, bindRoutes forwarding, missing #root error, and legacy render fallback.
packages/frontend-dev-utils/src/BuiCss.tsx Lazy-loaded import of @backstage/ui CSS for dev apps (with lint override).
packages/frontend-dev-utils/report.api.md API Extractor report for the new package.
packages/frontend-dev-utils/package.json Declares new package metadata, deps, peers, and build/test scripts.
packages/frontend-dev-utils/knip-report.md Adds initial knip report file for the package.
packages/frontend-dev-utils/catalog-info.yaml Registers the new package as a Backstage catalog component.
packages/frontend-dev-utils/README.md Adds package README with installation and brief context.
packages/frontend-dev-utils/.eslintrc.js Enables standard Backstage eslint configuration for the new package.
packages/cli/templates/new-frontend-plugin/package.json.hbs Updates template devDependencies to use @backstage/frontend-dev-utils.
packages/cli/templates/new-frontend-plugin/dev/index.tsx Updates template dev entrypoint to call createDevApp.
packages/cli-module-new/src/lib/version.ts Adds @backstage/frontend-dev-utils to the CLI version provider mapping.
packages/cli-module-new/src/lib/version.test.ts Verifies version provider returns the version for @backstage/frontend-dev-utils.
docs/tooling/cli/02-build-system.md Documents recommended dev/index setup for new frontend plugins using createDevApp.
docs/frontend-system/building-plugins/01-index.md Adds a “Running a dev server” section describing dev/ entrypoints and createDevApp.
docs/contribute/project-structure.md Adds frontend-dev-utils/ to project structure docs and clarifies dev-utils/ is legacy-system oriented.
.changeset/new-frontend-plugin-template-dev-utils.md Changeset for template/CLI updates to use the new helper.
.changeset/fix-plugin-header-resizeobserver-loop.md Changeset for the PluginHeader ResizeObserver loop warning fix.
.changeset/app-visualizer-use-frontend-dev-utils.md Changeset for app-visualizer dev entrypoint switch.
.changeset/add-frontend-dev-utils.md Changeset introducing the new @backstage/frontend-dev-utils package.

@Rugvip
Rugvip marked this pull request as ready for review March 16, 2026 18:28
@Rugvip
Rugvip marked this pull request as draft March 16, 2026 18:28
@Rugvip
Rugvip marked this pull request as ready for review March 16, 2026 18:33
@Rugvip
Rugvip marked this pull request as draft March 16, 2026 18:34
@Rugvip
Rugvip marked this pull request as ready for review March 16, 2026 18:51

@cdedreuille cdedreuille left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Patrik. The changes on PluginHeader looks solid.

@backstage-goalie backstage-goalie Bot added waiting-for:merge The PR has been approved and is awaiting merge. and removed waiting-for:review The PR needs a review and will be visible in the review queue unless already assigned an owner. labels Mar 16, 2026
@Rugvip
Rugvip merged commit 22f101e into master Mar 16, 2026
58 checks passed
@Rugvip
Rugvip deleted the rugvip/add-frontend-dev-utils branch March 16, 2026 20:32
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for contributing to Backstage! The changes in this pull request will be part of the 1.49.0 release, scheduled for Tue, 17 Mar 2026.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:documentation Improvements or additions to documentation size:large Large pull requests receive a slightly lower priority for reviews. waiting-for:merge The PR has been approved and is awaiting merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants