Contributing to the monorepo¶
Setup¶
Canonical first-time setup (same as CONTRIBUTING.md):
git clone https://github.com/eddiethedean/lessonkit.git
cd lessonkit
npm ci
npm run build:packages
npm test
Use npm install only when you change workspace dependencies (commit the updated package-lock.json). Run npm run build (packages + all examples) before wide refactors or release validation—not for every PR.
Node.js 20.19+ recommended for CLI scaffold workflows and CI parity. See Prerequisites.
Shipping a new React block? Start with Adding a framework block.
Common scripts¶
Command |
Purpose |
|---|---|
|
Packages + examples |
|
All workspace tests (runs |
|
Typecheck (builds packages first) |
|
Coverage report |
|
Dependency audit |
|
CLI pipeline integration (Node 18+) |
TypeScript conventions¶
The monorepo uses strict: true via tsconfig.base.json. When adding or changing types:
Validators take
unknown— parse JSON and narrow with guards before asserting domain types. Do not castas LessonkitCourseDescriptor(or similar) before validation completes.Discriminated unions at boundaries — CLI JSON output, manifest parse results, and telemetry events should narrow on a tag field (
ok,command,name, etc.).Exhaustive switches — use
assertNeverfrom@lessonkit/coreindefaultbranches when switching on a closed union.No explicit
any— ESLint enforces@typescript-eslint/no-explicit-anyon productionsrc/; tests and e2e may stay relaxed.Identity IDs —
CourseId,LessonId, andCheckIdare string aliases in 1.x; usevalidateId/assertValidIdat trust boundaries. True opaque branded IDs are planned for 2.0.
Package build order¶
Root build:packages builds core → xapi → accessibility → themes → lxpack → react → cli.
Full CI-equivalent checks¶
Before opening a PR that touches multiple packages or release surfaces, run from the repo root:
Check |
Command |
|---|---|
Template sync |
|
Template parity |
|
Build |
|
Typecheck |
|
Lint |
|
Test |
|
Coverage |
|
Storybook |
|
Integration |
|
E2E |
|
Conformance |
|
Audit |
|
API docs |
|
Block props doc |
|
Doc includes |
|
Sphinx docs |
|
TypeDoc API docs¶
TypeDoc HTML is generated, not hand-edited. Output path: docs/_static/typedoc/.
npm run build:packages
npm run docs:api
Read the Docs and CI run
docs:apibefore Sphinx — published TypeDoc links work on lessonkit.readthedocs.io.Local Sphinx without
docs:api— TypeDoc links inreference/api.md404 until you regenerate.Entry points include
@lessonkit/react/blocks(packages/react/dist/blocks-entry.d.ts). Seedocs/scripts/build-api-docs.sh.After changing block props in catalog sources, also run
node docs/scripts/generate-block-props-doc.mjs(included in docs CI).
Docs-only PRs need Python 3.12+ (pip install -r docs/requirements.txt) in addition to Node.
Docs site (this site)¶
Match CI:
npm run build:packages
npm run docs:api
bash docs/scripts/verify-doc-includes.sh
node docs/scripts/generate-block-props-doc.mjs
cd docs && pip install -r requirements.txt && sphinx-build -W -b html . _build/html
open _build/html/index.html
Optional: bash docs/scripts/build-docs-demos.sh embeds example course bundles (RTD runs this).
Read the Docs uses .readthedocs.yaml at the repo root. CI validates docs via the docs job in .github/workflows/checks.yml. Setup: READTHEDOCS.md.
Releases¶
Tag-based npm publish — RELEASING.md.
Roadmap¶
Framework milestones and 1.0 API stability are tracked in ROADMAP.md.
E2E and conformance¶
Export parity between React/Vite and LMS artifacts is enforced by Playwright and packaging scripts in e2e/. See the export parity guide for the full matrix.
Prerequisites: Node.js 20+; after npm ci, install Playwright once:
npm exec -w @lessonkit/e2e -- playwright install --with-deps chromium
Commands:
Command |
When to run |
|---|---|
|
Changes to |
|
Changes to |
|
Debugging flaky Playwright specs locally |
|
Changes to |
|
Golden example packaging or |
|
After changing global-setup artifact paths or harness fixture |
Details: e2e/README.md.