mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #122] [MERGED] fix(deploy): monorepo-aware lock file and node_modules resolution #328
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#328
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/122
Author: @harrisrobin
Created: 2/26/2026
Status: ✅ Merged
Merged: 3/7/2026
Merged by: @southpolesteve
Base:
main← Head:fix/monorepo-deploy-support📝 Commits (2)
1fba5aefix(deploy): monorepo-aware lock file and node_modules resolutionc638b86fix(test): clear npm_config_user_agent in npm fallback test📊 Changes
3 files changed (+185 additions, -30 deletions)
View changed files
📝
packages/vinext/src/deploy.ts(+13 -15)📝
packages/vinext/src/utils/project.ts(+68 -15)📝
tests/deploy.test.ts(+104 -0)📄 Description
Problem
vinext deployfails in monorepos in two distinct but related ways, both caused by the same assumption: that the project's lock file andnode_modulesare always in the app directory rather than potentially hoisted to a workspace root.1. Wrong package manager detected →
npm error Invalid Version:detectPackageManageronly checked forbun.lockb(legacy binary format), missingbun.lock(text format, introduced in Bun v1.0). It also only searched the immediate project directory, so any monorepo where the lock file lives at the workspace root fell through tonpm install -D, producing:2. Wrangler binary not found →
ENOENTdetectProjectcheckedhasCloudflarePlugin,hasRscPlugin, andhasWrangleronly in{root}/node_modules, producing false negatives for all three when packages are hoisted.runWranglerDeployhardcoded the same path, crashing with:Solution
Both problems share the same root fix: walk up ancestor directories until the relevant file is found, the same way npm/pnpm/yarn themselves resolve workspace roots.
Rather than two separate ad-hoc loops, this PR introduces a single shared primitive:
Both features are then built on top of it:
findInNodeModulesreplaces all four hardcodedfs.existsSync(path.join(root, "node_modules", ...))calls indeploy.ts, and provides the resolved binary path torunWranglerDeploy.Tests
12 new unit tests:
Supersedes #119 and #121 (closing those).
/bonk
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.