turbo
4b8cdc41 - feat(bun): bun prune support (#10175)

Commit
293 days ago
feat(bun): bun prune support (#10175) ### Description Resolves https://github.com/vercel/turborepo/issues/9058 and https://github.com/vercel/turborepo/discussions/7456 Building on https://github.com/vercel/turborepo/pull/9783 to add `prune` support for bun. This is a simple implementation that allow turbo to properly prune a `bun.lock` file Basically, it just creates a new `BunLockfileData` with the filtered dependencies/workspaces and serializes it to `bun.lock` via `serde_json`. This is made simple since the internal layout matches the bun.lock format, so the only special serialization case I had to do was `PackageEntry`. This also required updating the _deserialization_, since it skipped parsing some parts that we need to write back out. ### Testing Instructions 1. Clone https://github.com/mugencraft/turbobun (or any other turbo + bun repo) 2. `bun install --save-text-lockfile` (we need the new `.lock` version and not `.lockb`) 3. I then do ```sh rm -rf ./out && cp ../turborepo/target/debug/turbo ./node_modules/.bin/turbo # Copy debug build of turbo bunx turbo prune @turbobun/backend --docker --skip-infer # turbo prune 🚀 ``` 4. Open the generated `out/bun.lock`. It's currently outputted in an unformatted json, so I format it. 5. Observe that the dependencies include backend (`elysia`) and root workspace (`commitizen`) dependencies, but not e.g. `@turbobun/website` dependencies (like `next`) 6. `cd ./out/json && bun install` -> Bun install can read the lockfile and works! 7. You can also patch a random package using `bun patch` and test that the patches are propagated correctly ### Screenshots ![image](https://github.com/user-attachments/assets/8e059425-8e87-4d6e-9360-d49fbf65d105) --------- Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
Author
Parents
Loading