diff --git a/.gitignore b/.gitignore index b6efd5caf8a..4dfe5a02327 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ storybook-static/ openlibrary/components/dev/_dev.js +tests/e2e/reports/ +tests/e2e/screenshots/ +playwright-report/ +test-results/ *venv *.pyc *~ diff --git a/docs/ai/README.md b/docs/ai/README.md index 922baacd9bd..de040ba5bd9 100644 --- a/docs/ai/README.md +++ b/docs/ai/README.md @@ -167,6 +167,7 @@ These companion docs cover specific areas in depth: - [CSS](css.md) — BEM naming, selector rules, tokens in practice, bundle sizes, CSS-to-template wiring - [Design](design.md) — UI design patterns: typography, layout shift prevention, design tokens, animations - [Web Component Standards](web-components.md) — When to build a component, Lit conventions, accessibility, events +- [Front-End Dev Environment](front-end.md) — Build commands, Lit/jQuery timing trap, Colima LAN access, Playwright setup, known flaky tests, pre-commit.ci squash procedure ## Key File Locations diff --git a/docs/ai/front-end.md b/docs/ai/front-end.md new file mode 100644 index 00000000000..dc9d36ae4d8 --- /dev/null +++ b/docs/ai/front-end.md @@ -0,0 +1,276 @@ +# Front-End Dev Environment Guide + +Lessons from building the `ol-search-bar` LIT component. These are the non-obvious +gotchas that will waste your day if you don't already know them. + +--- + +## Build Commands: Which to Run and When + +| What changed | Command | +|---|---| +| CSS / LESS only | `docker compose run --rm home make css` | +| JS only (`openlibrary/plugins/openlibrary/js/`) | `docker compose run --rm home make js` | +| Lit components (`openlibrary/components/lit/`) | `docker compose run --rm home make lit-components` | +| Templates only | `docker compose restart web` (no make needed) | +| Multiple or unsure | `docker compose run --rm home make all` | +| After any make | `docker compose restart web` to pick up new bundles | + +**Do not skip `docker compose restart web`** after building JS or Lit components. The +web container caches the old bundle path and will serve stale assets. + +After `make js` or `make lit-components`, always verify the build succeeded with zero +errors before restarting: + +```bash +# Confirm the Lit bundle was written +ls -lh static/build/lit-components/ol-components.js +``` + +--- + +## LIT Component + jQuery Timing: The Load-Order Problem + +**This is the single most dangerous trap when wiring a new Lit component into OL's jQuery code.** + +`all.js` is loaded as a plain `