Lesson 0002 · ~12 minutes
One skill: sketch a monorepo as
workspace + projects + graph + tasks + targets — using
moon’s names so setup and moon run won’t feel alien later.
You can draw five boxes for any monorepo (workspace, projects, graph, tasks, targets) and point to where shared vs local config lives — still without installing moon.
Lesson 1: monorepo needs relationships + tooling, not only folders. moon names the pieces like this (concepts index):
.moon folder
(moon: Workspace).
moon.* config
(moon: Projects).
dependsOn and/or language-implied edges (e.g. package.json
workspace deps)
(moon: Project graph).
scope:task, e.g. app:lint. How you run work
and declare task-to-task deps
(moon: Targets).
Package manager workspaces still install/link packages. The orchestration layer is graph + tasks + targets.
Standardization lives in the split between workspace and project:
.moon/workspace.* — which paths are projects
(globs/map).
.moon/tasks/** — tasks defined once, inherited by many
projects
((task inheritance).
.moon/toolchains.* — pinned Node/Rust/… versions so
laptop ≈ CI
(toolchain).
moon.* in the project root — local tasks, overrides,
dependsOn, tags/layer/language.
“Easier maintenance” ≈ put the boring same-everywhere work in
.moon/tasks + toolchain, keep product-specific commands in
project moon.*.
| You type / write | Meaning |
|---|---|
moon run app:lint |
Project app, task lint |
moon run :lint |
lint in all projects |
deps: ['^:build'] |
Before this task, run build on each project this one
depends on
|
deps: ['typecheck'] |
Same project’s typecheck first (~) |
Mental model: project graph = structure; targets = how work is addressed on that structure.
moon’s project graph docs list real jobs: feed the task graph, Docker layering, project sync, and affected projects in CI (what the graph is used for). Without edges you fall back to “run everything” — collocation pain from lesson 1.
Equal-length options; retrieve the map from memory.
In moon terms, what is the workspace?
What is a target?
You want the same lint task on every TypeScript library.
Best home?
In task config, what does deps: ['^:build'] mean?
Recommended: moon — Concepts (skim Workspace, Project, Task, Target, Toolchain, Task inheritance). Then open the architecture sheet when you forget a name.
Optional depth: Project graph (explicit vs implicit edges; what the graph powers).