mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
* docs(readme): lead with quick start and scannable structure Restructure the README to match common OSS conventions: tagline and badges above the fold, copy-paste Quick start, Features list, and a compact Used by section. Remove the star plea, centered logo, and per-project marketing blurbs that pushed useful content down. Co-authored-by: Cursor <[email protected]> * docs(readme): playground GIF, used-by grid, and docs homepage sync Add data/used-by.json with build:used-by for README and docs homepage, playground demo capture, and shared home-section layout. Used by lists products with site logos; Financial Support keeps org and individual sponsors. Co-authored-by: Cursor <[email protected]> * chore: use .local for playground capture scratch files Co-authored-by: Cursor <[email protected]> * fix: satisfy eslint in build-used-by and capture scripts Co-authored-by: Cursor <[email protected]> * chore: drop one-off playground capture script Co-authored-by: Cursor <[email protected]> * refactor(docs): copy Used by from README like financial contributors Drop data/used-by.json and build-used-by.js; build-contributors.js now extracts USED-BY-BEGIN/END to used-by.swig. Co-authored-by: Cursor <[email protected]> * refactor(docs): inline Used by section, drop home-section partial Co-authored-by: Cursor <[email protected]> * fix(docs): drop redundant logo styles from .contributors Co-authored-by: Cursor <[email protected]> * fix(docs): build liquid bundle before hexo serve Co-authored-by: Cursor <[email protected]> * refactor(docs): drop playground window chrome from capture demo Co-authored-by: Cursor <[email protected]> * refactor(docs): revert playground capture changes to master behavior Restore Ace output pane, drop Prism and output-preview styling. Simplify docs:dev to rely on docs prestart. Co-authored-by: Cursor <[email protected]> * refactor(docs): rely on docs prebuild for liquid bundle and contributors Co-authored-by: Cursor <[email protected]> * feat(docs): show playground output as Prism-highlighted HTML code Co-authored-by: Cursor <[email protected]> * feat(docs): polish playground layout and regenerate README demo GIF * fix(docs): align playground GIF capture with live editor styling * fix(docs): unify playground pane padding and hold output on errors Match editor inset to the output panel, drop Prism from output preview, keep the last render while typing invalid template/context, and refresh the README demo GIF. * fix(docs): regenerate playground GIF with held output during typing * feat(docs): sync Used by logos and polish playground Inline README Used by grid on the docs homepage, refine playground layout and live output behavior, and drop the unused build-used-by script from package scripts. Co-authored-by: Cursor <[email protected]> * fix(docs): restore Rock RMS logo and remove duplicate entry Restore the official Rock RMS wordmark (GetImage.ashx?id=72534) instead of the SparkDevNetwork GitHub org avatar that was wrongly substituted for it. Co-authored-by: Cursor <[email protected]> * fix(docs): regenerate playground GIF with live indicator states Restore the capture script for the new pane-indicator layout so the README demo shows correct idle/active/pending/ok colors and pulsing animations while typing. * fix(docs): static playground GIF with correct indicator colors Capture one frame per keystroke with animations disabled so dot states (idle/active/pending/ok) match the live playground without pulsing. Co-authored-by: Cursor <[email protected]> * docs: use square Rock RMS icon in Used by section Co-authored-by: Cursor <[email protected]> * fix(docs): ensure capture indicator colors apply instantly Disable indicator transitions and cancel active animations before setting data-state so pending yellow is not stuck on the prior ok green. Co-authored-by: Cursor <[email protected]> * docs: point Microsoft Used by link to microsoft.com The merged tile title covers Power Pages and Azure API Management; href should go to Microsoft home, not Power Pages only. Co-authored-by: Cursor <[email protected]> * docs: remove Dailycontributors from Used by section No evidence they run on LiquidJS; they are an OpenCollective sponsor only. Co-authored-by: Cursor <[email protected]> * docs: reword intro to say Liquid, not Shopify Liquid Move Shopify into the compatibility list and drop the shopify/liquid link from README; align package.json description. Co-authored-by: Cursor <[email protected]> * fix(docs): restore playground output as Prism-highlighted HTML Co-authored-by: Cursor <[email protected]> * docs: add extensible to README intro and package description EOF Co-authored-by: Cursor <[email protected]> * chore: move playground capture script to .local Co-authored-by: Cursor <[email protected]> * fix(docs): drop unused Ace mode-html from playground Output pane uses Prism, not Ace; template and context editors still need liquid/json modes and basePath for themes. Co-authored-by: Cursor <[email protected]> * docs: sync intro sentence across package and site metadata Align package.json, docs config, manifest, llms.txt, and AGENTS.md tagline to the README canonical description. Co-authored-by: Cursor <[email protected]> * docs: trim verbose intro in intro-to-liquid tutorial Remove README tagline and repo-purpose copy duplicated by the recent metadata sync. Co-authored-by: Cursor <[email protected]> * docs: shorten homepage banner subtitle Trim docs site banner and short taglines after the em dash; keep full description for meta tags and npm/README. * docs: simplify playground GIF caption in README Co-authored-by: Cursor <[email protected]> * docs: dedupe homepage subtitle and description into _config.yml Remove redundant front matter from index.pug; theme falls back to site config for banner and meta tags. Co-authored-by: Cursor <[email protected]> --------- Co-authored-by: Cursor <[email protected]>
95 lines
4.4 KiB
Markdown
95 lines
4.4 KiB
Markdown
# LiquidJS
|
|
|
|
A simple, expressive, extensible Liquid template engine for JavaScript — Shopify, Jekyll and GitHub Pages compatible, for Node.js, browsers, and the CLI, with TypeScript support. TypeScript in `src/`, bundles in `dist/`. Docs site in `docs/` (Hexo, `navy` theme).
|
|
|
|
## Layout
|
|
|
|
| Path | Contents |
|
|
| --- | --- |
|
|
| `src/parser`, `src/render`, `src/tags`, `src/filters` | Template parse and render |
|
|
| `src/context`, `src/template`, `src/tokens` | Scope, templates, token stream |
|
|
| `src/util/async.ts` | `toPromise`, `toValueSync`, `toLiquidAsync` |
|
|
| `test/` | Jest |
|
|
| `docs/source/` | Doc markdown; sidebar in `docs/source/_data/sidebar.yml` |
|
|
| `docs/themes/navy/` | Layout, CSS, JS |
|
|
| `.local/` | Scratch, repro, PoC (gitignored) |
|
|
|
|
## Commands
|
|
|
|
```
|
|
npm run build # after src/ changes, before npm test
|
|
npm test
|
|
npm run lint
|
|
npm run check # build + build:docs + test + lint + perf:diff (manual)
|
|
npm run build:docs
|
|
cd docs && npm start # http://localhost:4000
|
|
npm run perf:diff
|
|
```
|
|
|
|
PR CI (`pull_request`): build, lint, test, coverage, performance. Docs build runs on push to `master` only.
|
|
|
|
PR titles: conventional format (`feat:`, `fix:`, `docs:`, …) — checked by CI. Releases on `master` use semantic-release from merged commits.
|
|
|
|
Backward-compatible API changes expected unless doing an intentional major break.
|
|
|
|
## Architecture
|
|
|
|
All core logic is one `function *` per feature. Use `yield` where you'd normally `await` a potentially async value.
|
|
|
|
- `toPromise(generator)` — async driver; awaits yielded promises
|
|
- `toValueSync(generator)` — sync driver; passes yielded values through as-is
|
|
|
|
Never duplicate logic into separate async and sync methods. One generator serves both paths.
|
|
|
|
When wrapping an async+sync pair (e.g. `contains`/`containsSync`, `readFile`/`readFileSync`), use `toLiquidAsync(asyncFn, syncFn?)` — returns a `LiquidAsync<F>` that picks sync or async via a leading `sync: boolean` arg. `yield` the result inside a generator. See `src/util/async.ts`.
|
|
|
|
## Style
|
|
|
|
Make minimal changes only. Avoid sweeping edits. Always check after you made changes.
|
|
|
|
- Change only what the task requires. No drive-by refactors, test harnesses, or extra files unless asked.
|
|
- Match existing patterns in the file you edit.
|
|
- Repro, PoC, and scratch files go in `.local/` — not tracked `poc/` folders or one-off scripts under `docs/`.
|
|
|
|
### Comments
|
|
|
|
- Do not add narrative comments. Code should be clear from structure and naming; if it needs explanation, refactor instead.
|
|
- Comments follow existing repo usage only: non-obvious invariants, `@deprecated`, JSDoc on public API where TypeDoc needs it. Not for explaining changes to the author, migration history, or restating what the code already says.
|
|
- Comments document the code; they do not fix unclear code.
|
|
|
|
### Tests
|
|
|
|
- Assert observable behavior, not internal implementation details.
|
|
- Avoid duplicate coverage; keep test diffs minimal.
|
|
- **E2E** (`test/e2e/`): import from the package root (resolves to `dist/` via `package.json`). Do not import from `src/` — e2e must match what npm consumers get.
|
|
- **Integration/unit** (`test/integration/`, etc.): may import from `src/` against current TypeScript sources.
|
|
|
|
### Docs site
|
|
|
|
- Reuse existing asset paths under `docs/source/` and `docs/themes/navy/` — no new asset directories unless asked.
|
|
- Front matter `title:` is plain text (no backticks).
|
|
- `docs/source/llms.txt` — deployed to https://liquidjs.com/llms.txt for web agents (llms.txt spec).
|
|
- After theme/markdown changes: build or serve locally, check in a browser (light and dark), not only curl or editor preview.
|
|
|
|
### README
|
|
|
|
- Research original sources before reordering contributors, logos, or lists.
|
|
|
|
## Verify
|
|
|
|
- Do not commit, push, amend, or open a PR unless asked.
|
|
- After changes: verify yourself via CLI or UI (tests, `cd docs && npm start`, browser) before reporting done. Do not tell the user to check instead.
|
|
- Before push on sweeping changes: run `npm run check`.
|
|
- Confirm facts from `.github/workflows`, `package.json`, and library docs — not stale human docs or assumptions.
|
|
- When replacing or integrating a library: read its docs and understand what the previous setup did before changing behavior.
|
|
|
|
### Security fixes
|
|
|
|
- Reproduce on current `master` first. Smallest fix that addresses the reported issue.
|
|
- If Shopify/Ruby Liquid behaves the same, document unsafe usage in filter/docs instead of changing behavior.
|
|
|
|
## Docs
|
|
|
|
- Published: https://liquidjs.com
|
|
- Repo agent instructions: this file (`AGENTS.md`)
|