You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a Documentation section covering npm run build-docs, and makes clear it
is an occasional on-request task rather than something to run after editing
source, since it rewrites about a hundred files.
Also corrects the testing notes, which said tests should not call engineInit.
That is no longer true now that manual step mode exists.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ These instructions are for making changes in the LittleJS repo safely. Optimize
11
11
- Make changes in `src/` (and `plugins/` when appropriate), then run the build.
12
12
-**Match surrounding style.** Follow the conventions in the files you touch.
13
13
-**Avoid breaking public APIs.** If a change could break users, call it out clearly and offer a compatible alternative.
14
-
-**Keep agent-generated working files under `.claude/`.**`docs/` is the published JSDoc API site — do not write into it. Superpowers plans go in `.claude/superpowers/plans/` and specs in `.claude/superpowers/specs/` (overrides the skill defaults). The `.claude/` folder is gitignored.
14
+
-**Keep agent-generated working files under `.claude/`.**`docs/` is the published JSDoc API site and is fully generated — never hand-edit it, and don't regenerate it unless asked (see Documentation below). Superpowers plans go in `.claude/superpowers/plans/` and specs in `.claude/superpowers/specs/` (overrides the skill defaults). The `.claude/` folder is gitignored.
15
15
16
16
If anything in this doc conflicts with the actual repo behavior, follow the repo behavior and update this doc.
17
17
@@ -171,10 +171,22 @@ npm test
171
171
```
172
172
173
173
- Tests target `dist/littlejs.esm.js` — rebuild with `npm run build` after changing source.
174
-
-[test/setup.mjs](test/setup.mjs) stubs minimal DOM and enables headless mode. Tests shouldn't call `engineInit`, `render()`, or assume `time` advances.
174
+
-[test/setup.mjs](test/setup.mjs) stubs minimal DOM and enables headless mode. Most tests shouldn't call `engineInit` or `render()`, or assume `time` advances — construct objects directly instead.
175
+
- To test time-driven logic (timers, cooldowns, spawns), call `setEngineManualStep(true)` before `engineInit`, then advance with `engineStep(frames)`. See [test/engineStep.test.mjs](test/engineStep.test.mjs). Call `engineInit` once per file at module scope: `frame` and `time` are module globals and monotonic, and `node --test` gives each test file its own process.
175
176
- Zero test dependencies — uses Node's built-in `node --test`. Match the style in [test/](test/) when adding new ones.
176
177
- CI runs build + test on every push/PR ([.github/workflows/test.yml](.github/workflows/test.yml)).
177
178
179
+
### Documentation
180
+
```bash
181
+
npm run build-docs
182
+
```
183
+
184
+
- Generates the JSDoc site into `docs/` from `src/` and `plugins/`, with `README.md` as the homepage. Tooling lives in [tools/](tools/).
185
+
-**This is not part of the normal workflow — do not run it after editing source.** It takes ~17s, rewrites ~100 files, and produces a large diff. The docs do not need to be current on every change. The repo owner asks for it when they want it.
186
+
- It is worth *suggesting* when a major feature or new plugin lands, after a significant rework, or before a release. A plugin that never gets regenerated never appears on the site at all — `textureSheet` and `threejs` were both missing from the published docs for exactly that reason.
187
+
- CI does not run it. `jsdoc` and `clean-jsdoc-theme` are devDependencies.
188
+
- jsdoc exits non-zero on the TypeScript-flavored JSDoc used across the engine (tuples like `[Vector2, Vector2, number]`, predicates like `a is Array<any>`) which it cannot parse but which `dist/littlejs.d.ts` needs for precise types. The script verifies the generated output instead of the exit code — don't "fix" those JSDoc types to silence the errors.
0 commit comments