Skip to content

build: generate example routes - #809

Merged
fh1ch merged 1 commit into
mainfrom
build/generate-routes
Aug 25, 2026
Merged

build: generate example routes#809
fh1ch merged 1 commit into
mainfrom
build/generate-routes

Conversation

@spike-rabbit

@spike-rabbit spike-rabbit commented Aug 19, 2026

Copy link
Copy Markdown
Member

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Example routes and web-component loaders are maintained manually, so new examples require changes in multiple source files. Generated route files can also become stale without detection in CI.

What is the new behavior?

An Angular builder discovers example components and generates both the application routes and web-component loaders through npm run build:routes. The build pipeline runs this command and fails if it changes tracked files.

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@spike-rabbit
spike-rabbit requested a review from a team as a code owner August 19, 2026 11:22
@spike-rabbit
spike-rabbit force-pushed the build/generate-routes branch from 0588aa7 to ab8183f Compare August 19, 2026 11:26
@fh1ch fh1ch added the enhancement New feature or request label Aug 19, 2026
@spike-rabbit
spike-rabbit force-pushed the build/generate-routes branch 2 times, most recently from 79a4f4f to 9d04154 Compare August 19, 2026 13:18
@spike-rabbit
spike-rabbit changed the base branch from main to refactor/rename-large-data-set-example August 19, 2026 13:22
@spike-rabbit
spike-rabbit force-pushed the build/generate-routes branch 2 times, most recently from 54d28d8 to 4296232 Compare August 19, 2026 13:37
@fh1ch
fh1ch requested a lite review from Copilot August 19, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces a custom Angular builder that auto-discovers example components and generates both the application route configuration and the web-components loader map, wiring this into the build/CI pipeline to prevent generated files from going stale.

Changes:

  • Added @ngx-datatable/example-routes-builder (workspace package) to scan src/app/**/**.component.ts examples and generate src/app/app.routes.ts + src/app/app.web-components.ts.
  • Updated app + web-components entrypoints to consume the generated route/loader outputs.
  • Added CI verification step (npm run build:routes && git diff --exit-code) to ensure generated files are up-to-date.

Reviewed changes

Copilot reviewed 72 out of 73 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/example-routes-builder/tsconfig.json TS config for compiling the custom Angular builder to ESM output.
tools/example-routes-builder/package.json Declares the builder workspace package and its builder manifest entrypoint.
tools/example-routes-builder/example-routes-builder.schema.json Builder options schema (sourceRoot + output file paths).
tools/example-routes-builder/example-routes-builder.mts Builder implementation: example discovery + TS AST codegen + Prettier formatting.
tools/example-routes-builder/builders.json Registers the builder implementation and schema for Angular CLI.
src/main.web-components.ts Switch-based loader replaced with generated exampleLoaders map lookup.
src/main.ts Switched routing import from removed manual routing module to generated routes file.
src/app/app.web-components.ts New generated map of example name -> dynamic import loader for web-components build.
src/app/app.routes.ts New generated Angular Routes array for examples.
src/app/app.component.ts Title now read from activated component’s static exampleTitle; keeps reading route data for dark/sourcePath.
src/app/app.component.html Router outlet activation now passes $event component instance into routeActivate.
src/app/app-routing.module.ts Removed manual route list (replaced by generated app.routes.ts).
src/app/basic/bootstrap-theme.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/context-menu.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/css-classes.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/dark-theme.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/disabled.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/dynamic-row-height.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/empty-template.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/filtering.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/fixed-row-height.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/fluid-row-height.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/footer-template.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/full-screen.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/hidden-on-load.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/horz-vert-scrolling.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/inline-editing.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/large-data-set.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/live-data.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/multiple-tables.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/responsive.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/row-detail.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/row-grouping.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/rxjs.component.ts Adds static exampleTitle for route/title generation.
src/app/basic/vert-dynamic-scrolling.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/column-pinning.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/column-reorder.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/column-toggling.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/fixed-column.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/flex-column.component.ts Adds static exampleTitle for route/title generation.
src/app/columns/force-column.component.ts Adds static exampleTitle for route/title generation.
src/app/drag-drop/drag-drop.component.ts Adds static exampleTitle for route/title generation.
src/app/paging/client-side-paging.component.ts Adds static exampleTitle for route/title generation.
src/app/paging/scrolling-no-virtual.component.ts Adds static exampleTitle for route/title generation.
src/app/paging/scrolling-server-side.component.ts Adds static exampleTitle for route/title generation.
src/app/paging/server-side-paging.component.ts Adds static exampleTitle for route/title generation.
src/app/paging/virtual-server-side.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/cell-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/checkbox-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/custom-checkbox-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/disable-selection-callback.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/multi-click-and-checkbox-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/multi-click-row-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/multi-row-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/selection/single-row-selection.component.ts Adds static exampleTitle for route/title generation.
src/app/sorting/client-side-sorting.component.ts Adds static exampleTitle for route/title generation.
src/app/sorting/comparator.component.ts Adds static exampleTitle for route/title generation.
src/app/sorting/default-sort.component.ts Adds static exampleTitle for route/title generation.
src/app/sorting/server-side-sorting.component.ts Adds static exampleTitle for route/title generation.
src/app/summary/custom-template-summary.component.ts Adds static exampleTitle for route/title generation.
src/app/summary/inline-html-summary.component.ts Adds static exampleTitle for route/title generation.
src/app/summary/server-side-paging-summary.component.ts Adds static exampleTitle for route/title generation.
src/app/summary/simple-summary.component.ts Adds static exampleTitle for route/title generation.
src/app/summary/summary-row-actions.component.ts Adds static exampleTitle for route/title generation.
src/app/templates/inline-template.component.ts Adds static exampleTitle for route/title generation.
src/app/templates/template-ref.component.ts Adds static exampleTitle for route/title generation.
src/app/tree/client-side-tree.component.ts Adds static exampleTitle for route/title generation.
src/app/tree/full-screen-tree.component.ts Adds static exampleTitle for route/title generation.
package.json Adds build:routes script and workspace declaration for the builder package.
package-lock.json Updates lockfile for workspace linking of the builder package.
angular.json Adds build-routes target using the new builder.
.prettierignore Ignores generated route/loader files for Prettier CLI runs.
.github/workflows/test_and_deploy.yml Adds CI step to verify generated outputs match tracked files.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/example-routes-builder/example-routes-builder.mts
Comment thread tools/example-routes-builder/example-routes-builder.mts Outdated
Comment thread src/main.web-components.ts
Comment thread tools/example-routes-builder/example-routes-builder.mts Outdated
@spike-rabbit
spike-rabbit force-pushed the build/generate-routes branch 2 times, most recently from 9a970f6 to 69e2c25 Compare August 20, 2026 06:35
Base automatically changed from refactor/rename-large-data-set-example to main August 25, 2026 20:07
@fh1ch
fh1ch force-pushed the build/generate-routes branch from 69e2c25 to a37588e Compare August 25, 2026 20:07

@fh1ch fh1ch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@spike-rabbit no findings, let's see how well this works.

LGTM 👍

@fh1ch
fh1ch force-pushed the build/generate-routes branch from a37588e to fa3d9d8 Compare August 25, 2026 20:58
@fh1ch
fh1ch added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 2bfa949 Aug 25, 2026
9 checks passed
@fh1ch
fh1ch deleted the build/generate-routes branch August 25, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants