fix(deploy): detect bun.lock text format and walk up to monorepo root#119
Closed
harrisrobin wants to merge 2 commits intocloudflare:mainfrom
Closed
fix(deploy): detect bun.lock text format and walk up to monorepo root#119harrisrobin wants to merge 2 commits intocloudflare:mainfrom
harrisrobin wants to merge 2 commits intocloudflare:mainfrom
Conversation
detectPackageManager only checked for bun.lockb (the old binary lockfile), missing bun.lock — the text-based format introduced in Bun v1.0. It also only checked the immediate project directory, causing it to fall back to npm in monorepo setups where the lock file lives at the workspace root. Both issues together produce a confusing "npm error Invalid Version:" failure when running vinext deploy from a Bun monorepo workspace. Changes: - Add bun.lock check alongside the existing bun.lockb check - Walk up parent directories until a lock file is found (same behaviour as npm/pnpm/yarn when resolving workspace roots) - Apply the same two fixes to detectPackageManagerName - Add unit tests covering: pnpm, yarn, bun.lock, bun.lockb, npm fallback, monorepo root traversal, and closest-wins precedence
Contributor
Author
harrisrobin
added a commit
to harrisrobin/vinext
that referenced
this pull request
Feb 26, 2026
…factored) Replaces the individual cloudflare#119 and cloudflare#121 fixes with the combined version from PR cloudflare#122. Introduces walkUpUntil<T> as a shared primitive, with detectPackageManager and findInNodeModules both built on top of it.
southpolesteve
added a commit
that referenced
this pull request
Feb 27, 2026
…nd supports SSR (#119) Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com> Co-authored-by: Steve Faulkner <sfaulkner@cloudflare.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
detectPackageManager(anddetectPackageManagerName) inutils/project.tshad two bugs that combined to makevinext deployfail in Bun monorepos:Wrong lockfile name. The function only checked for
bun.lockb— the legacy binary format. Bun v1.0+ writes a text-basedbun.lockfile. Projects using Bun ≥ v1.0 were not detected as Bun workspaces.No upward directory traversal. In a monorepo the lock file lives at the workspace root, not inside each app directory. When called from e.g.
apps/web/, the function only checked that directory — missed the root — and fell through tonpm install -D.Both issues together produced this confusing error at the end of the npm fallback:
Fix
bun.lockcheck alongside the existingbun.lockbcheck.detectPackageManager(returns install command) anddetectPackageManagerName(returns pm name).The helper is refactored into two small functions:
checkLockFiles(single-directory check) andfindLockFile(the upward walk), keeping each unit testable in isolation.Tests
7 new unit tests in
tests/deploy.test.ts:pnpm-lock.yamlyarn.lockbun.lock(text, new)bun.lockb(binary, legacy)apps/web/→ lock file at workspace root)pnpm-lock.yamlbeats outerbun.lock)pnpm run lintandpnpm run typecheckpass clean./bonk