Repository navigation
frontend-dev-utils: add helper for plugin dev apps - #33368
Conversation
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
25f2369 to
16133e9
Compare
There was a problem hiding this comment.
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-utilswith acreateDevApphelper that wrapscreateAppand renders into#root. - Updates
@backstage/plugin-app-visualizerdev entry point to usecreateDevApp. - Documents the recommended
dev/index.tssetup 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. |
🎨 Visual Testing with Chromatic
|
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
There was a problem hiding this comment.
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-utilswithcreateDevApp(+ docs, API report, tests). - Updated new-frontend-plugin template and app-visualizer dev entrypoints to use
createDevApp. - Updated
PluginHeaderto 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
There was a problem hiding this comment.
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-utilswithcreateDevApp({ features, bindRoutes }), including React 17/18 render-path split and clearer missing-#rooterror. - Switch dev entrypoints (template + app-visualizer) to use
createDevApp, and document the recommended pattern. - Update
PluginHeaderheight 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. |
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
There was a problem hiding this comment.
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-utilswith a minimalcreateDevApp({ features, bindRoutes })helper, including React 17/18 render-path support, lazy BUI CSS loading, and clearer#rooterrors. - Updated built-in examples and the new frontend plugin template to use
createDevAppinstead of manually wiringcreateApp+ ReactDOM rendering. - Fixed
PluginHeaderheight updates to reduce ResizeObserver loop warnings by scheduling updates viarequestAnimationFrameand 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. |
cdedreuille
left a comment
There was a problem hiding this comment.
Thanks Patrik. The changes on PluginHeader looks solid.
|
Thank you for contributing to Backstage! The changes in this pull request will be part of the |
Hey, I just made a Pull Request!
Draft for now while awaiting feedback.
This adds
@backstage/frontend-dev-utilsas a small helper for wiring up NFS plugin dev apps, keeps thecreateDevAppAPI intentionally small withfeaturesandbindRoutes, and fixes aPluginHeaderresize-observer warning that showed up in the dev app when used together withFullPage.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
Signed-off-byline in the message. (more info)