Install CLI commands from a local workspace or an NPM package into Bun's global package store. Supports command selection and Bun runtime override. Excellent for dev builds of MCPs and other to...
This is a CLI tool I initially built as a convenient and reliable way to install executable(s) from a local monorepo workspace into Bun's global package store.
I had a local monorepo with workspace dependencies that needed to be installed as a whole. The commands aren't bundled, and I didn't want to manually manage dependencies. (If you want to try it out, https://github.com/open-pencil/open-pencil is what I was contributing to)
I tried `bun link` initially. But linking directly meant I had to keep a separate local checkout just so branch switches wouldn't break my installed tools. `bun-install` solves this by packaging the dependencies and installing a snapshot to Bun's global store instead.
I later added the `--bun` (and `--package`) options, which mirror the `bunx` option which supports using `bun` over `node`, after I ran into some annoying JS-execution-environment-related issues. I've found the recurring theme with JS-managed commands is they tend to be fragile when installed globally on machines used for development purposes, susceptible to both runtime and update time incompatibilities and breakages. I concluded this was something of a confluence of factors: A vast ecosystem, numerous runtime environments, and indirection between what's installed (the module) and what's executed (the contents of the bin directory end users add to their PATH). This project doesn't magically fix all of those, but, for me personally, it has completely resolved what was a long-standing pain point.
Highlights:
- Topological resolution: builds and packs sibling dependencies in order.
- Command filtering: `bun-install -p my-cli tool-a`. Strips unselected commands from the manifest so they don't clobber existing global symlinks.
- Shebang rewriting: forces Node shebangs to `#!/usr/bin/env bun` (and injects them if missing). Installed commands actually run under Bun.
- Safe binary scanning: does an 8 KiB null-byte scan so it doesn't mangle non-node scripts or native executables.
- Workspace support: install the local state, great for dev, works with internal dependencies that aren't published.
- Cleans up temporary tarballs and drains TTY input on interactive prompts to prevent stdin bleed.
(pre-v1, so the API might change, but the core implementation is stable).
Try it out: bun add -g bun-install
NPM: https://www.npmjs.com/package/bun-install GitHub: https://github.com/joeycumines/bun-install
I'll be around to answer any questions. Might not respond immediately though :)
0 comments
No comments yet.
Related stories
- Hacker News · 3 points · 4 days ago
- Hacker News · 15 points · about 8 hours ago
- Launch HN: Vespper (YC F24) – SOTA Docx MCPvespper.comHacker News · 31 points · 3 days ago
- Show HN: NetWasm – Independent .NET Compiler/Runtime (82.5 KB Hello World in C#)playground.netwasm.comHacker News · 5 points · 3 days ago
- Hacker News · 1 points · 4 days ago
- Hacker News · 1 points · 9 days ago