Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BunPath ¶ added in v1.25.0
func BunPath() string
BunPath resolves the host bun binary: the official installer drops it in ~/.bun/bin, which is not on the controlled PATH lerd gives host workers, so check there first and fall back to PATH. Returns "" when bun isn't installed.
func BunVersion ¶ added in v1.25.0
func BunVersion() string
BunVersion returns the host bun version (e.g. "1.3.14"), or "" when bun isn't installed or doesn't run. The exec result is cached for 30s because callers like the UI status snapshot rebuild on every poll and WebSocket push; the version rarely changes within that window (`bun upgrade` reflects on the next refresh).
func Bunify ¶ added in v1.25.0
Bunify rewrites the npm/npx/node command verb to its bun equivalent (npm->bun, npx->bunx, node->bun) for every command in a shell chain, so `npm run build && npm run preview` becomes `bun run build && bun run preview`. Segments are split on the shell operators &&, ||, |, ;, & (operators inside quotes don't split); each segment is rewritten independently.
func DetectVersion ¶
DetectVersion detects the Node.js version for the given directory. It checks, in order:
- .lerd.yaml node_version field (explicit lerd override)
- .nvmrc
- .node-version
- package.json engines.node
- global config default
func JSRuntime ¶ added in v1.25.0
JSRuntime returns the explicit per-project JS runtime override from .lerd.yaml's js_runtime field, normalized to "bun", "node", or "" (unset / unrecognized, meaning auto-detect). Node aliases (node/nodejs/npm) all map to "node" so a small typo doesn't silently defeat the override and re-force bun.
func ListInstalled ¶ added in v1.23.0
func ListInstalled() []string
ListInstalled returns every Node major version installed under fnm, in the order fnm reports them. Empty when fnm isn't on disk or the user has no versions installed. Centralises the parsing previously duplicated in internal/ui/server.go and internal/mcp/server.go so every surface (web UI, MCP, TUI) sees the same list with the same dedupe rules.
func SystemNodeAvailable ¶ added in v1.25.0
func SystemNodeAvailable() bool
SystemNodeAvailable reports whether a `node` binary is resolvable on PATH (outside lerd's own fnm shims). Used to decide the bun fallback and to surface the active JS runtime in the UI.
func UsesBun ¶ added in v1.25.0
UsesBun reports whether the project in dir should run its JS tooling through bun instead of npm. The .lerd.yaml js_runtime override wins ("bun" forces bun, "node"/"npm" forces Node); otherwise lerd auto-detects bun from a bun.lockb / bun.lock / bunfig.toml file or a packageManager: bun field. (When no Node is available at all, the host-worker path falls back to bun unless js_runtime pins Node; see bunRunnerFor.)
Types ¶
This section is empty.