Skip to content

feat(node): support pnpm binaries in monorepo workspaces - #586

Open
iloveitaly wants to merge 2 commits into
railwayapp:mainfrom
iloveitaly:pnpm-monorepo-binaries
Open

feat(node): support pnpm binaries in monorepo workspaces#586
iloveitaly wants to merge 2 commits into
railwayapp:mainfrom
iloveitaly:pnpm-monorepo-binaries

Conversation

@iloveitaly

@iloveitaly iloveitaly commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Motivation

In pnpm monorepos, builds fail when one workspace package exposes a bin and another depends on it via workspace:*. Railpack runs pnpm install before workspace source files are copied, so pnpm cannot link the binary and downstream build scripts cannot find it.

Fixes #584

Description

Detect workspace packages with bin entries and copy the full workspace layer before install, matching the approach already used for lifecycle scripts and local file dependencies. Secret exposure during install is limited to workspaces that define lifecycle scripts, so binary-only workspaces do not receive secrets unnecessarily.

Test

  • Add examples/node-pnpm-monorepo-binaries integration test where package-b runs package-a's hello-cli bin during build
  • Unit tests for PackageJson.HasBin() and Workspace.HasPackageBins()

- Add a new example project to reproduce an issue where pnpm workspace binaries are not correctly linked during build scripts.
- Includes a basic monorepo structure with two packages, where package-b depends on a binary provided by package-a.

Generated-by: aiautocommit
- Add Bin field to PackageJson model to detect executable definitions.
- Update install logic to copy the full workspace layer when binaries are present, ensuring they are correctly linked.
- Restrict secret exposure during install to only when lifecycle scripts are defined, excluding binary-only workspaces for improved security.

Generated-by: aiautocommit
@iloveitaly iloveitaly changed the title fix: properly install binaries from pnpm monorepo workspaces feat(node): support pnpm binaries in monorepo workspaces Jun 6, 2026
@vixalien

Copy link
Copy Markdown

Hello @iloveitaly do you have instructions on how I can test it on my local repo and then maybe we can later get it merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm doesn't relink monorepo binaries

2 participants