Skip to content

feat: Overhaul react-examples build - #1110

Open
rkaraivanov wants to merge 14 commits into
vnextfrom
rkaraivanov/astro-migration
Open

rkaraivanov wants to merge 14 commits into
vnextfrom
rkaraivanov/astro-migration

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Summary

Replace the gulp + Vite samples browser with the Astro setup used by igniteui-wc-examples (vnext). Samples are built in place from samples/, one static page per sample. The old browser/ app is gone.

Why

  • gulp updateBrowser copied every sample into browser/src and regex-rewrote its source on every start and build.
  • Two dependency trees, ~110 browser packages (many unused), TypeScript 4.9, CRLF churn in every file.
  • No tests or type-check in CI. CD rewrote sources to the licensed package names before building.

What changes

Samples browser

  • Astro static site at the repo root. src/pages/[...slug].astro emits a page per sample; its loader imports the sample and renders its default export. A Vite plugin strips the sample's own standalone mount; the build fails if a sample does not match that contract.
  • One chunk per sample and per npm package. Theme sheets are linked in <head>, sample CSS is inlined: pages are styled at first paint and no sample's CSS reaches another page.
  • Deleted: browser/ (gulp tasks, generated routes, service worker, cache busting), azure-pipelines/, root leftovers.

URLs and docs contracts (unchanged for consumers)

  • Canonical: /react-demos/{group}/{component}/{name}.
  • /react-demos/samples/... (README and docs links) redirects there and keeps the sidebar.
  • Legacy /react-demos/{group}/{component}-{name} redirects there.
  • Code viewer JSON: same schema, same /code-viewer/... path.
  • Docs iframe bridge: theme message and fitContent sizing kept.

Tooling

  • One root package.json and lockfile. Scripts: dev, build, preview, check, test:smoke, add:sample, update:ig, generate:code-viewer, copy:themes.
  • Package versions live in scripts/lib/versions.js; npm run update:ig applies them to the root and every sample.

CI / CD

  • ci.yml: version sync check, astro check, build with BASE_PATH=/react-demos, Playwright smoke tests.
  • build-and-deploy.yml: swaps trial packages for licensed ones with npm (a resolve plugin maps imports; no source rewriting), builds without source maps. Artifact name, zip layout and the igniteui-actions dispatch payload are unchanged.
  • Dependabot added.

Samples

  • LF line endings everywhere; ReadMe.md → README.md; run instructions fixed; CodeSandbox links removed.
  • Removed per-sample .eslintrc.js, sandbox.config.json, .devcontainer/. The nine react-scripts samples now use Vite.
  • Packages: igniteui-react, -grids, -dockmanager 19.9.0 (19.7.0 pointed its types at files it did not ship), igniteui-webcomponents ~7.4.1, igniteui-grid-lite ~0.11.0, React 19.3. Sample tooling: TypeScript 5.9, Vite 8, Vitest 5.
  • 119 hand-maintained samples (inputs, layouts, menus, notifications, scheduling) converted to function components with hooks, typed, with a strict tsconfig.json. Generator-owned samples were left alone.
  • Fixed for the new build: a stray Node http import, an import path outside igniteui-react-grids' exports, and a webpack-only worker import.
  • The four itemized data-chart samples are unpublished (missing data source; gulp skipped them too).

Verification

Run locally on the branch head:

  • All 955 published samples rendered from a BASE_PATH=/react-demos build: 948 with no page or console error. The rest fail the same way standalone (grids/*/editing-lifecycle ×3, grids/data-grid/pager, grids/data-grid/binding-remote-data) or are blocked by third-party hosts on localhost (dock-manager/embedding-frames, geo-map/display-esri-imagery).
  • Smoke suite (28 tests) passes with and without BASE_PATH. Mutation-checked: disabling the mount strip or the non-entry CSS handling fails it.
  • Licensed deploy simulated with the IG packages only under node_modules/@infragistics/: build and smoke suite pass.
  • Code viewer output diffed against the last gulp output: differences only from later sample edits, converted samples, and .scss files (now included).
  • Function-component conversion: identical rendered DOM for all 119 samples against the previous build, and identical DOM after 414 scripted clicks; dock manager layouts compared with seeded randomness.
  • astro check clean; standalone sample builds pass on Vite 8.

Reviewing

  • Go commit by commit. The line-ending commit changes only .gitattributes (the index was already LF).
  • Most of the 5,600+ changed files are sample package.json version bumps, README edits and deleted boilerplate.
  • The core of the change is astro.config.mjs and src/; each Vite plugin documents why it exists.

Follow-ups

  • igniteui-xplat-examples React editor template, so the next generated drop does not undo this: drop .eslintrc.js, sandbox.config.json, .devcontainer/ and the CodeSandbox button; match scripts/lib/versions.js; moduleResolution: bundler in tsconfig.json; the README fixes; and fix the mount line in editors/x-date-picker/{date-limits,editing,format}, grids/data-grid/row-selection and grids/data-grid/column-resizing (broken standalone, fine in the browser).
  • The five pre-existing broken samples listed above.

The old rules forced CRLF on checkout for every text type while the
index already held LF. Every working-tree file differed from the
index, which confused diffs and non-Windows tooling. Use LF in both
places on every OS; binaries stay untouched.
Samples carried files that no longer served a purpose: ESLint
configs that disabled every rule, CodeSandbox settings, and
devcontainer definitions. Nine grid samples still ran on
react-scripts; move them to the Vite setup every other sample uses.

Rename ReadMe.md to README.md so every sample uses one name, and
point the gulp README generator at the new name until it is removed.

Drop root files nothing reads: the CRA .env, a stub lockfile,
.eslintignore, .gitconfig, a commented-out CODEOWNERS, the Azure
pipeline (trigger: none), and the Windows cleanup script.
Replace the gulp tasks with plain Node scripts that read samples in
place: version sync (update:ig), code-viewer generation, theme
copying and a new-sample scaffold. The root package.json and
lockfile will host the Astro samples browser next; browser/ stays in
use until then.

Code-viewer output keeps the gulp schema and URL, so the docs site
needs no change.
igniteui-react and igniteui-react-grids 19.7.0 declare type entry
points they do not ship. 19.9.0 fixes this and requires
igniteui-webcomponents 7.4 and igniteui-grid-lite 0.11.

Move sample tooling to TypeScript 5.9 and React 19 types. The IG
packages publish types only through "exports", which older
TypeScript cannot read; 5.9 still accepts the generated tsconfigs.
tree-grid/disabled-summaries imported Node's http module by
accident. grid/localization imported igniteui-react-grids/grids,
which the package does not export; only the old browser's aliases
resolved it. geo-map/display-heat-imagery loaded its worker with
webpack-only syntax; use new Worker(new URL(...)), which Vite
bundles.
Mirror the igniteui-wc-examples setup: one static page per sample,
built from samples/ in place, one chunk per sample and per npm
package, and themes linked in <head>. This removes browser/, its
copy step, generated routes, service worker and cache busting.

Old URLs keep working. /samples/<slug> redirects to the canonical
path with the sidebar; legacy /<group>/<component>-<name> routes
redirect as well. CI and CD build from the root and publish dist/.
Vite bundles workers with their own plugin list, so the scoped
resolver never ran for them. With licensed @infragistics/ packages
installed, the heat-imagery worker could not resolve
igniteui-react-core and the deploy build failed.
Playwright smoke tests run against the production build and guard
what the Astro setup exists to prevent: shared code or CSS leaking
between sample pages and samples mounting twice. They also cover
the sidebar, old-URL redirects and the docs iframe contract.

CI type-checks, builds with the deployed base path, runs the smoke
tests and fails if sample package versions drift. Deploy swaps in
the licensed packages with npm instead of rewriting sources, and
keeps the artifact and igniteui-actions dispatch unchanged.
The generated READMEs pointed at a template that no longer exists,
ran git checkout before entering the clone, and asked for
--legacy-peer-deps, which the samples no longer need. CodeSandbox
is no longer supported, so its button goes too.
Rewrite the README for the root dev server, production builds,
smoke tests, sample scaffolding and version updates, replacing the
gulp and browser/ steps.
19.7.0 points its "exports" types at a file it does not ship, so
TypeScript cannot see the dock manager types. 19.9.0 fixes this;
its bundled igniteui-dockmanager moves from 2.1 to 2.2.
Move 119 hand-written inputs, layouts, menus, notifications and
scheduling samples from class components to function components
with hooks and typed props. Drop the igniteui-react Module
register() calls, which the package marks as no longer needed.

Give these samples the strict add:sample tsconfig, so their
standalone build type-checks. Rendered DOM, before and after
scripted clicks, matches the previous build.
@ChronosSF ChronosSF self-assigned this Oct 5, 2026
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