Get started
Six steps from a repo with no Lattice in it to a build that comes back from cache the second time you run it. You need a terminal and the tools your workspaces already use. The transcripts are from a repo with two npm packages, app and greet, whereapp depends on greet.
Install it into your repo
From the root of the repo you want to use Lattice in:
The script picks the archive for your platform, checks its SHA-256 against the release's published checksums, and refuses to install on a mismatch. The binary lands in
.lattice/bin/, and the script adds that path to your.gitignoreif the repo already has one. The only thing it writes outside the repo is aPATHline in your shell config. To skip that line, pass--no-modify-pathand call./.lattice/bin/latticedirectly.That script covers macOS, Linux, and Windows under Git Bash. In PowerShell, run the Windows installer instead:
irm https://latticeandcompany.github.io/lattice/install.ps1 | iexIt writes the same
.lattice\binand adds that directory to your userPATH, asking first. Every published build is listed on thereleases page. SeeInstallation for the switches both installers take.Check that it runs
lattice --versionlattice 2.0.0If your shell can't find
lattice, open a new terminal so thePATHline takes effect.Initialize
lattice initinitreads the repo before it writes anything. It finds the workspaces yourpackage.json,pnpm-workspace.yaml,Cargo.tomlorgo.workalready name, and on a terminal it offers any other projects it found and any tool versions the repo already pins.-ytakes what it offers without asking. Then it shows every workspace it sees, the tool that runs it and the tasks it can run:✓ wrote lattice.json ✓ wrote .lattice/schema.json ✓ updated .gitignore 2 workspaces: app npm build test greet npm build next: lattice run buildCommit
lattice.jsonand.lattice/schema.json, which lets your editor check the config as you type.initgitignores the rest of.lattice/, which is per-machine.Read what it wrote
{ "$schema": ".lattice/schema.json", "latticeVersion": "2.0.0" }That is the whole config for this repo. The packages come from the root
package.json'sworkspaces, the tool from the lockfile, the tasks from each package'sscripts, and the order fromapp's dependency ongreet. Ask what a run would do before running it:lattice run build --dry-run❖ lattice dry run · build → greet:build npm run build → app:build npm run buildA project no workspace file names, a dependency between languages, or a command you want to write yourself goes in
lattice.json. SeeConfiguration.Install dependencies
lattice setupsetupchecks or installs any tool versions you pinned, then runs each workspace's own installer, once per lockfile: here, onenpm install. Run it as often as you like. Lattice skips a workspace whose lockfile hasn't changed.Run a task
lattice run build❖ lattice build · 2 workspaces ✓ greet 0.12s ✓ app 0.12s ❖ 2 tasks 0.27sgreetbuilds beforeappbecauseappdepends on it. Workspaces with no dependency between them run at the same time. While a run is going, the live display shows each running task with the last lines it printed and what the rest are waiting on; in CI, or with--stream, you get one plain line per event instead.Run it again without changing a file:
❖ lattice build · 2 workspaces ● greet cached · 0.12s saved ● app cached · 0.12s saved ❖ 2 tasks · 2 cached 0.00s · 0.23s saved ❖❖❖ FULL POWERNothing changed, so nothing ran. Each package's
dist/came back out of.lattice/cache/. Edit a file ingreetand it builds again, and so doesapp, which depends on it. Run it from insidepackages/greetand onlygreetbuilds.