This monorepo uses a hierarchical task structure where top-level tasks orchestrate and implementation tasks do the actual work.
Orchestration Targets (defined in root nx.json targetDefaults):
build- Orchestrates all build steps across packagestest- Runs tests (depends onbuild:compile)check- Runs all quality checksrelease- Prepares release artifactsclean- Cleanup tasksdev- Development servers
Implementation Tasks (package-specific scripts in package.json):
build:compile- TypeScript compilationbuild:api- API Extractor documentationbuild:docs- TypeDoc generationbuild:manifest- OCLIF manifest (CLI packages)build:readme- OCLIF readme (CLI packages)build:generate- Command snapshots (CLI packages)build:site- Astro builds (doc sites)build:vite- Vite builds (Svelte apps)build:tauri- Tauri desktop buildstest:unit,test:coverage,test:e2e- Test variantscheck:format,check:types,check:deps,check:policy- Quality checks
Libraries (fundamentals, cli-api, levee-client, etc.):
build:compile → build:api → build:docsCLI Tools (cli, dill, repopo, sort-tsconfig):
build:compile → build:manifest → build:readme → build:generateDocumentation Sites (dill-docs, repopo-docs):
build:site (Astro only)- Top-level tasks orchestrate, never implement - The
buildtarget innx.jsoncalls implementation tasks - Implementation tasks use
:separator - e.g.,build:compile,test:coverage - Nx runs only what exists - If a package doesn't define
build:api, it won't run - All config in root - No package-level
project.jsonfiles (all in rootnx.json) - Package scripts define implementations - Each package's
package.jsondefines its specific build steps
When adding a new task type:
- Add to root
nx.jsonwith appropriatedependsOn,inputs,outputs - Add to package
package.jsonscripts for packages that need it - Follow naming convention: Use
:separator for implementation tasks - Define dependencies: Use
dependsOnto ensure proper task ordering
Example:
This monorepo uses repopo to enforce consistency across packages. Run pnpm run check:policy to validate or pnpm run fix:policy to auto-fix violations.
| Policy | Description | Auto-Fix | Matches | Pattern | Excluded |
|---|---|---|---|---|---|
| NoJsFileExtensions | (no description) | No | JavaScript files | `(^ | \/)[^/]+\.js$` |
| PackageJsonProperties | (no description) | No | JavaScript files | `(^ | \/)package\.json` |
| PackageJsonRepoDirectoryProperty | (no description) | No | JavaScript files | `(^ | \/)package\.json` |
| PackageJsonSorted | (no description) | No | JavaScript files | `(^ | \/)package\.json` |
| PackageScripts | (no description) | No | JavaScript files | `(^ | \/)package\.json` |
| SortTsconfigs | (no description) | No | tsconfig files | `.*\.?tsconfig\.json$` | - |
| NoPrivateWorkspaceDependencies | (no description) | No | JavaScript files | `(^ | \/)package\.json` |
This monorepo includes infrastructure for testing with tsgo, the Go-based TypeScript compiler that will become TypeScript 7.0. Shadow testing helps validate compatibility before the official release.
- TypeScript 6.0 - Final JavaScript-based TypeScript (bridge release)
- TypeScript 7.0 - Go-based compiler (
tsgo) with ~10x performance improvement @typescript/native-preview- npm package providingtsgofor testing
# Type-check only with tsgo (no emit)
pnpm check:types:native
# Build with tsgo (compiles to esm/)
pnpm compile:native
# Clean build with tsgo (removes old output first)
pnpm compile:native:clean
# Run smoke tests against tsgo-compiled output
pnpm test:tsgo-build
# Full workflow: build with tsgo + run smoke tests
pnpm test:tsgo-build:full| File | Purpose |
|---|---|
tsconfig.tsgo.json |
Solution file listing packages for tsgo builds |
scripts/test-tsgo-build.mts |
Smoke test that validates compiled JS output |
The tsconfig.tsgo.json solution file includes 17 packages. Excluded packages:
- Astro sites (
dill-docs,repopo-docs) - Use specialastro/tsconfigs/*extends
The smoke test validates 13 packages by importing compiled output and executing basic functions:
@tylerbu/fundamentals - isSorted()
@tylerbu/fundamentals/set - addAll()
@tylerbu/cli-api - CommandWithConfig class
lilconfig-loader-ts - TypeScriptLoader class
xkcd2-api - getRandomComicId()
levee-client - LeveeClient class
rehype-footnotes - plugin export
remark-lazy-links - plugin export
remark-shift-headings - plugin export
remark-task-table - plugin export
sort-tsconfig - sortTsconfigFile()
repopo - module loads
Typical build times on this codebase:
| Compiler | Time | Speedup |
|---|---|---|
tsgo |
~0.8s | 4.3x faster |
tsc |
~3.5s | baseline |
-
Add the package path to
tsconfig.tsgo.json:{ "path": "./packages/new-package" } -
Add a smoke test in
scripts/test-tsgo-build.mts:results.push( await testPackage( "new-package", "packages/new-package/esm/index.js", (mod: any) => { if (typeof mod.someExport !== "function") { throw new Error("someExport is not a function"); } }, ), );
-
Run tests to verify:
pnpm compile:native && pnpm test:tsgo-build
The tsgo-validation job in .github/workflows/pr-build.yml runs in parallel with the main build:
- Builds all packages with
tsgo - Runs smoke tests to validate the compiled output
This catches tsgo compatibility issues early, before TypeScript 7.0 is released.
"Cannot find module" errors during tsgo build:
- Ensure the package is listed in
tsconfig.tsgo.json - Check that project references are correctly configured in the package's
tsconfig.json - Verify dependencies are installed (
pnpm install)
Smoke test failures:
- Check the actual exports in
packages/<name>/esm/index.js - Update the test function to match actual export names
- Some packages may have different default exports