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.

  1. 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 .gitignore if the repo already has one. The only thing it writes outside the repo is a PATHline in your shell config. To skip that line, pass --no-modify-path and call./.lattice/bin/lattice directly.

    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 | iex

    It writes the same .lattice\bin and adds that directory to your userPATH, asking first. Every published build is listed on thereleases page. SeeInstallation for the switches both installers take.

  2. Check that it runs

    lattice --version
    lattice 1.1.1

    If your shell can't find lattice, open a new terminal so thePATH line takes effect.

  3. Scaffold a config

    lattice init

    On a terminal, init scans the repo first, then asks you to confirm the workspaces and the pinned tool versions it found. If the scan finds nothing, it walks you through adding them one at a time. To write what the scan finds without being asked, add-y.

    ✓ wrote lattice.json
    ✓ wrote .lattice/schema.json
    ✓ updated .gitignore
    
    next: lattice run build

    lattice.json is your config. Commit .lattice/schema.json too, so your editor validates that config as you type. init gitignores the rest:.lattice/cache/, .lattice/toolchains/, and.lattice/bin/ are all per-machine.

  4. Declare your workspaces

    A workspace is a directory with its own manifest. It is the unit Lattice runs and caches tasks in. List each one by literal path, and say which ones depend on which:

    {
      "$schema": ".lattice/schema.json",
      "latticeVersion": "1.1.1",
      "workspaces": [
        { "name": "ui",  "path": "packages/ui" },
        { "name": "web", "path": "apps/web", "dependsOn": ["ui"] }
      ],
      "tasks": {
        "build": {
          "dependsOn": ["^build"],
          "inputs": ["src/**/*"],
          "outputs": ["dist/**"]
        }
      }
    }

    Each workspace runs the tool already in its directory, identified from that directory's lockfile or manifest. ^build means the build task of every workspace this one depends on, run first. inputs are the files the cache watches for changes, and outputs are the files it captures and restores. To write a command yourself instead, set "auto": false on the workspace and give it a scripts map.

  5. Install dependencies

    lattice setup
    ❖ lattice  setup
    ● ui npm install
    ● web npm install
    ❖ setup complete

    setup installs any tool versions you pinned, then installs each workspace's own dependencies. Run it as often as you like. Lattice skips a workspace whose lockfile hasn't changed.

  6. Run a task

    lattice run build -v
    lattice: running `build` across 2 workspaces
    lattice: ui:build: hash 6ab2b4b8a24730ea
    lattice: ui:build: cache miss (nothing cached for this task yet)
    ui:build: running
    ui:build: done (0.25s)
    lattice: web:build: hash e7006757504cd76c
    lattice: web:build: cache miss (nothing cached for this task yet)
    web:build: running
    web:build: done (0.20s)
    lattice: 2 tasks, 0 cached, 0 failed, 0.46s

    ui builds before web because web depends on it. Workspaces with no dependency between them run at the same time. -v is short for --verbose, and it prints this plain log. Without it, on a terminal, you get a live display instead.

    Run it again without changing a file:

    lattice: running `build` across 2 workspaces
    lattice: ui:build: hash 6ab2b4b8a24730ea
    ui:build: cache hit [6ab2b4b8]
    lattice: web:build: hash e7006757504cd76c
    web:build: cache hit [e7006757]
    lattice: 2 tasks, 2 cached, 0 failed, 0.00s, 0.45s saved
    lattice: full power, nothing to run

    Same hashes, so nothing re-ran. dist/ came back out of.lattice/cache/. Edit a file under src/ and that workspace's hash changes. That workspace builds again, and so does anything that depends on it. Everything else still comes from cache.