worktree-dev-port
v0.4.0
Published
Give every git worktree its own stable local dev port, discoverable by any tool with a plain `git wdp-port` call. No pipe, no socket, no discovery endpoint.
Maintainers
Readme
worktree-dev-port
Node-side helper for Umbraco.Community.WorktreeDevPort. Reads or assigns the local dev port stored in the current git worktree's own git folder — no pipe, socket, or running discovery endpoint required.
Install
npm install worktree-dev-portUsage
import { getPort, getOrAssignPort } from "worktree-dev-port";
// If something else (e.g. the paired NuGet package) already assigned a port.
// Throws if this worktree has no port yet:
const port = getPort();
// Or, to assign one yourself if nothing has yet:
const port = await getOrAssignPort();
// getOrAssignPort(basePort, rangeSize, mainWorktreePort) also accepts overrides.
// The main checkout gets mainWorktreePort (44355 by default) when it's free;
// pass null to always use the pool instead.See the root README for how this fits with the .NET side.
