Skip to content

fix: Tweaks for nub support - #13187

Merged
anthonyshew merged 1 commit into
vercel:mainfrom
colinhacks:nub-create-turbo-login-hint
Jul 1, 2026
Merged

anthonyshew merged 1 commit into
vercel:mainfrom
colinhacks:nub-create-turbo-login-hint

Conversation

@colinhacks

@colinhacks colinhacks commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

We maintain nub and have been testing Turborepo's nub support (added in #13120 / #13169 / #13179) end-to-end against a create-turbo --package-manager nub monorepo. This carries three fixes; each is scoped to crates/turborepo-repository/src/package_manager/ and the create-turbo login hint. R1 below is a heads-up only, not a code change here.

1. Correct the create-turbo remote-cache login hint

The post-scaffold hint for nub printed nub turbo login, which errors: turbo is a project-local binary, and nub runs local binaries through nub exec (alias nubx), not as a bare nub <name> subcommand. Setting the nub executable to nub exec makes the hint read nub exec turbo login, matching the package-binary-exec form already used for the other managers (npx, pnpm dlx, yarn dlx, bunx).

2. Detect nub only via the packageManager field, not the lockfile name

detect_package_manager treated the presence of nub's native lock.yaml as a nub signal. This drops that: nub is now recognized only through the packageManager field / devEngines.packageManager. nub's lockfile name is deliberately neutral and nub is lockfile-compatible with whatever the project already uses, so the file's presence is not a reliable nub signal. Lockfile parsing is unchanged — once nub is detected via the field, PackageManager::Nub { lockfile } still parses lock.yaml through the underlying (pnpm) path; only the name-based detection is removed.

Note

Detection tradeoff: a nub project identified only by a bare lock.yaml — no packageManager field, no other recognized lockfile — is no longer detected as nub. Turborepo falls back to its normal lockfile-based detection, which finds no package manager when only lock.yaml is present. The field is written on the adoption paths that matter: the create-turbo nub template writes devEngines.packageManager, and nub pm use nub writes it when converting an existing project — so scaffolded and converted repos are covered. A hand-authored, field-less nub repo is not. We think the field is the more robust signal, but the narrower lockfile-name coverage is your call.

3. Build internal workspace edges in a nub monorepo (link_workspace_packages)

In a nub monorepo, Turborepo discovers the workspace packages but builds no internal dependency edges between them: web#build depends on nothing, where the same scaffold under pnpm or npm depends on @repo/ui#build et al. Two consequences: dependents serve stale cache after an internal package changes, and turbo prune --docker web drops the internal packages entirely (the pruned build then fails to resolve @repo/ui).

Root cause: the create-turbo nub template declares internal deps with a bare specifier ("@repo/ui": "*"), like the npm and bun templates — not "workspace:*". PackageManager::Nub delegated link_workspace_packages to its underlying lockfile format (pnpm), which defaults to false on pnpm 9, so is_internal treated every non-workspace: internal dep as external. npm, yarn, and bun all return true here, and nub links a bare specifier to the local workspace package exactly as they do (nub symlinks it and records version: link:... in its lockfile). This sets link_workspace_packages to true for nub, putting it on the same edge-resolution path as npm/bun rather than pnpm's workspace:-only default. It reuses the existing package.json dependency-splitting path — no new lockfile-graph machinery.

Reproduction on current main (turbo 2.10.3-canary.4):

# nub scaffold (before this change)
$ turbo build --dry=json | jq '.tasks[] | select(.taskId=="web#build") | .dependencies'
[]                                    # ❌ no internal edges
$ turbo prune web --docker
 - Added web                          # ❌ @repo/ui dropped

# same scaffold under npm (link_workspace_packages = true, identical "*" specifiers)
$ turbo build --dry=json | jq '.tasks[] | select(.taskId=="web#build") | .dependencies'
["@repo/eslint-config#build","@repo/typescript-config#build","@repo/ui#build"]   # ✓

The fix puts nub on that same true path, so the nub scaffold resolves identically. Covered by unit tests in package_manager/mod.rs (test_nub_links_workspace_packages_unlike_underlying_pnpm) and the detection tests in nub.rs / mod.rs. cargo test -p turborepo-repository is green (219 tests).

R1 (heads-up, not fixed here): Turbopack workspace-root inference

On a fresh nub scaffold, the first turbo build hits Next/Turbopack's own workspace-root inference, which keys off recognized lockfile names and doesn't include nub's lock.yaml, so it warns and infers the wrong root. That lives in Next's root-inference code, not this module, so it's out of scope for this PR — flagging it in case the two teams want to coordinate. The identical pnpm scaffold builds clean.

Happy to adjust any of these or split them if you'd prefer separate PRs.

@colinhacks
colinhacks requested a review from a team as a code owner June 30, 2026 23:24
@colinhacks
colinhacks requested review from Copilot and tknickman and removed request for a team June 30, 2026 23:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@colinhacks is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
vercel Bot temporarily deployed to Preview – turborepo-eve-agent June 30, 2026 23:24 Inactive
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
turborepo-eve-agent Canceled Canceled Jun 30, 2026 11:24pm

@colinhacks
colinhacks marked this pull request as draft June 30, 2026 23:48
@colinhacks colinhacks changed the title fix(create-turbo): print 'nub exec turbo login' remote-cache hint Fix nub package-manager support: field-only detection, workspace edges, login hint Jul 1, 2026
@colinhacks
colinhacks marked this pull request as ready for review July 1, 2026 00:06
@anthonyshew

Copy link
Copy Markdown
Contributor

@colinhacks, can you update so history only has verified signatures? It's a requirement at our GitHub org level.

…or nub

Detect nub only through the packageManager field / devEngines.packageManager,
not the presence of its lock.yaml. nub's lockfile name is neutral and nub is
lockfile-compatible with whatever the project already uses, so the file's
presence is not a reliable nub signal. Lockfile parsing once nub is detected
via the field is unchanged.

Return true from link_workspace_packages for the Nub variant. nub links a
local workspace package for a bare version specifier ("pkg": "*"), like
npm/yarn/bun, so delegating to the underlying pnpm lockfile format (which
defaults to false on pnpm 9) dropped every internal workspace edge declared
without the workspace: protocol, causing stale cache and turbo prune --docker
to drop internal deps.

Also: set the nub executable to 'nub exec' so the post-scaffold remote-cache
hint reads 'nub exec turbo login' (turbo is a local binary; nub runs local
binaries via 'nub exec', not as a bare 'nub <name>' subcommand).
@colinhacks
colinhacks force-pushed the nub-create-turbo-login-hint branch from 0a6499f to ec2eacb Compare July 1, 2026 16:15
@anthonyshew anthonyshew changed the title Fix nub package-manager support: field-only detection, workspace edges, login hint fix: Support for nub (field-only detection, workspace edges, login hint) Jul 1, 2026
@anthonyshew anthonyshew changed the title fix: Support for nub (field-only detection, workspace edges, login hint) fix: Support for nub tweaks Jul 1, 2026
@anthonyshew anthonyshew changed the title fix: Support for nub tweaks fix: Tweaks for nub support Jul 1, 2026
@anthonyshew anthonyshew changed the title fix: Tweaks for nub support fix: Tweaks for nub support Jul 1, 2026
@anthonyshew
anthonyshew merged commit ca029ee into vercel:main Jul 1, 2026
36 of 51 checks passed
anthonyshew pushed a commit that referenced this pull request Jul 1, 2026
## Release v2.10.3-canary.7

> [!CAUTION]
> Versioned docs aliasing FAILED. [View
logs](https://github.com/vercel/turborepo/actions/runs/28533309207)

### Changes

- fix: Handle task executor join errors as internal errors (#13148)
(`c4017e9`)
- fix:  Tweaks for nub support (#13187) (`ca029ee`)
- release(turborepo): 2.10.3-canary.6 (#13194) (`b79f767`)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
anthonyshew pushed a commit that referenced this pull request Jul 3, 2026
## Release v2.10.3

> [!CAUTION]
> Versioned docs aliasing FAILED. [View
logs](https://github.com/vercel/turborepo/actions/runs/28672736782)

### Changes

- feat: Add nub to create-turbo options (#13173) (`82b1cf1`)
- release(turborepo): 2.10.2 (#13174) (`ec30b18`)
- release(turborepo): 2.10.3-canary.1 (#13176) (`47e2b22`)
- fix: Normalize package manager versions (#13177) (`658f607`)
- fix: Use singular workspace in package resolution error (#13178)
(`d199c53`)
- fix: Support nub native lockfiles (#13179) (`50546e6`)
- perf(build): Enable thin LTO + codegen-units=1 for release builds
(#13160) (`628aea9`)
- release(turborepo): 2.10.3-canary.2 (#13181) (`16aed08`)
- feat: Add aube package manager support (#13183) (`0f78006`)
- release(turborepo): 2.10.3-canary.3 (#13184) (`fec7cee`)
- fix: Normalize package manager version output (#13185) (`f469ed8`)
- release(turborepo): 2.10.3-canary.4 (#13186) (`406fe59`)
- refactor: Richer internal dependency data (#13188) (`909c696`)
- fix: Honor package manager version ranges (`136273e`)
- fix: Skip node_modules in boundaries checks (#13191) (`93741a0`)
- fix: Add token exchange recovery guidance (#13192) (`bef588b`)
- feat: Add --production flag to turbo prune (#13190) (`3777442`)
- release(turborepo): 2.10.3-canary.5 (#13193) (`ca20ca2`)
- feat: Accept Bun lockfile version 2 (#13119) (`69e2085`)
- fix: Handle task executor join errors as internal errors (#13148)
(`c4017e9`)
- fix:  Tweaks for nub support (#13187) (`ca029ee`)
- release(turborepo): 2.10.3-canary.6 (#13194) (`b79f767`)
- release(turborepo): 2.10.3-canary.7 (#13195) (`b426736`)
- chore: Upgrade TypeScript to 7.0.1-rc (#13144) (`cf07baa`)
- docs: Add filtered installs to Vercel guide (#13196) (`7e70b52`)
- examples: add with-mcp-servers (#12997) (`8eb4d9d`)
- fix: Report malformed JSON parse errors instead of panicking (#13198)
(`a69df7d`)
- fix: Improve error messaging when platform binary is missing (#13199)
(`8e145f0`)
- release(turborepo): 2.10.3-canary.8 (#13200) (`5987ed1`)
- fix(watch): recover from slow initial hash instead of timing out
(#13159) (`05e26cb`)
- chore: Update vitest example to vitest 4 and use native test merging
(#13202) (`e2b61dc`)
- feat: Toggle between the TUI and streamed logs (#13203) (`1325455`)
- fix: Resolve Bun scoped package deps that share a name with a
dependency (#13207) (`e4773ab`)
- feat: Select tasks by clicking rows in the TUI task list (#13206)
(`c568f67`)
- perf: Avoid deep-cloning dependency maps in lockfile closure cache
(#13209) (`abd84cf`)
- perf: Cache root internal dependencies in package graph (#13211)
(`7ec8c6d`)
- feat: Automatically copy TUI selection to clipboard on mouse release
(#13208) (`61d6013`)
- perf: Cache env wildcard matches across tasks during hashing (#13210)
(`148b1dd`)
- perf: Replace per-package graph traversals in scope filtering (#13212)
(`28d1871`)
- perf: Derive dirty hash from repo index (#13213) (`b521d32`)
- fix: Include untracked symlinks in repo-index dirty hash (#13218)
(`c3c91ab`)
- refactor: Use upstream libghostty-vt crates instead of vendored
bindings (#13205) (`c2115dc`)
- fix: Remove devtools feature flag (#13219) (`65efe27`)
- fix: Harden TUI terminal restore during shutdown (#13220) (`dccab93`)
- fix: Correct gitignore precedence in untracked walk and memoize
matcher chains (#13221) (`bc32fcc`)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants