← Back to archive

Repo of the Day

ds300/lazyrepo

Published: Apr 10, 2023

Open repository ↗

Caching task runner for npm/pnpm/yarn monorepos. A simpler, TS based version of turborepo.

Summary

lazyrepo is a caching task runner for npm, pnpm, and yarn monorepos, written in TypeScript. It runs package scripts in dependency order, caches results, and re-runs only the affected work when files change. The README explicitly warns that the project is in the prototyping stage and may have breaking changes.

What it is useful for

The tool targets monorepos where package.json scripts need to scale but adopting a full system like nx, bazel, rush, or buck is too heavy. It is meant to fill the same niche as turborepo, providing incremental script execution without writing custom orchestration.

The README's worked example uses three packages: core, utils, and primitives, where core depends on both utils and primitives. Running lazy run test executes the tests for utils and primitives concurrently, then starts core only after both succeed. If a source file in utils changes, the next run executes utils then core and skips the unaffected primitives. The --filter option accepts glob patterns, for example --filter="packages/*-utils", to target a subset of packages, and --force bypasses the cache so every task runs.

How engineers can use it

The documented setup is:

  1. Install the CLI globally: npm install lazyrepo@alpha --global
  2. Add it as a dev dependency at the repo root: npm install lazyrepo@alpha --save-dev
  3. Append .lazy to .gitignore.

With no config, lazy run <script-name> runs the named script across packages, respecting dependency order. Arguments after -- are forwarded to the underlying command, for example lazy run test -- --runInBand. Running lazy init creates a lazy.config.js (or .json) file. A typical config block declares cache inputs, outputs, and whether the task inherits input files from upstream packages via inheritsInputFromDependencies: true.

For projects with duplicated script entries, replacing a script value with lazy inherit and adding a baseCommand under scripts.<name> in the config file lets npm test (or any other runner) look the actual command up from the config. Other documented commands are lazy clean, which deletes all local cache data, and lazy run with --force to ignore cached results. Because the project is in alpha, the README advises expecting breaking changes and points to a Discord channel for help.