Skip to content
vxvx
GitHubBlueskydev.toRSS
Blog

Ship one app, not the whole monorepo

vx prune copies one project and the workspace packages it needs into a clean folder, with the lockfile cut to match. Your Docker build installs only what it ships, and a change in another app no longer busts the install layer.

A Docker image for one app should not install the dependencies of forty others. And when another team bumps a package in their app, your image’s install layer should not rebuild. vx prune cuts the workspace down to what one project needs.

The demo workspace has four packages. @demo/web depends on @demo/ui, and @demo/docs pulls in picocolors from npm.

Terminal window
$ vx prune @demo/web --docker
vx prune: 2 projects → out (json/ + full/), bun.lock pruned
@demo/ui (packages/ui)
@demo/web (packages/web)

The output has only the two projects web needs. The root package.json lists only their folders, and the lockfile drops every entry nothing kept reaches:

Terminal window
$ grep -c picocolors bun.lock out/json/bun.lock
bun.lock:2
out/json/bun.lock:0
$ cd out/full && bun install --frozen-lockfile
Checked 4 installs across 3 packages (no changes) [2.00ms]

The pruned lockfile keeps the package manager’s own layout, so a frozen install accepts it as is.

--docker splits the output in two. json/ holds only what the install reads, so Docker caches that layer until a dependency of this app changes. full/ holds everything else.

COPY out/json/ .
RUN bun install --frozen-lockfile
COPY out/full/ .
RUN bunx vx run @demo/web#build

vx prune is a verb that @vzn/vx-lockfile adds through the plugin commands seam. Declare the plugin for your package manager, and the verb appears:

vx.workspace.ts
import { defineWorkspace } from '@vzn/vx/config'
import { bun } from '@vzn/vx-lockfile'
export default defineWorkspace({ plugins: [bun()] })

pnpm(), npm() and yarn() work the same way. The same plugin keys each task on its own project’s dependencies, which Lockfile-aware keys covers. Every rule and refusal is in the vx-lockfile README.

Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.