fix(frameworks): Also check devDependencies when inferring framework in single-package mode#12056
Conversation
…in single-package mode In single-package mode (is_monorepo: false), framework inference only checked `package_json.dependencies`, causing frameworks installed as devDependencies (Vite, Astro, SvelteKit, etc.) to not be detected. Fix: when not in a monorepo, check both `dependencies` and `dev_dependencies` fields when matching framework deps. Fixes: vercel#12023
|
@sleitor is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Can you explain why there are two of these? #12038 |
|
Hi @anthonyshew — there were two because I initially filed #12038 as a general fix, then realized the issue specifically affects single-package mode (non-monorepo projects) where the framework detection uses a separate code path. I filed this PR (#12056) with a more targeted fix for that specific path, linked to the issue (#12023). I've now closed #12038 as a duplicate. This PR (#12056) is the canonical fix. |
anthonyshew
left a comment
There was a problem hiding this comment.
Thanks! I'll add some more test coverage in a follow-up PR.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
The failures on this PR are flakes associated with changes that I made that aren't compatible for forks. In the interest of getting this fix out, we will merge, and I will fix these flakes in follow-up PRs. |
…pport (#12122) ## Summary Followup to #12056. Adds boundary/negative test cases for the `devDependencies` framework detection change that were identified during review but missing from the original PR. ## New test cases - **Empty dependencies in non-monorepo** — Baseline confirming `None` when `PackageInfo` has no deps in single-package mode - **devDependencies ignored in monorepo mode** — Negative test ensuring the monorepo path reads `unresolved_external_dependencies` only, not `package_json.dev_dependencies` - **Strategy::All with deps split across dependencies and devDependencies** — SolidStart scenario: `solid-js` in `dependencies`, `solid-start` in `devDependencies` - **Strategy::Some with devDependency in non-monorepo** — `react-scripts` in `devDependencies` matches `create-react-app` Also adds a `deps()` test helper to reduce the repeated `.into_iter().map(|(s1, s2)| (s1.to_string(), s2.to_string())).collect()` boilerplate. ## Testing `cargo test -p turborepo-frameworks` — 19/19 pass (15 existing + 4 new).
## Release v2.8.13-canary.15 Versioned docs: https://v2-8-13-canary-15.turborepo.dev ### Changes - release(turborepo): 2.8.13-canary.14 (#12120) (`0e593bb`) - examples: Fix markdown links inside code blocks in basic README (#11946) (`755bc3a`) - fix: Install capnproto on Windows for fork PRs that lack remote cache (#12121) (`40cdef2`) - fix(frameworks): Also check devDependencies when inferring framework in single-package mode (#12056) (`cb12132`) - test: Add boundary tests for framework inference `devDependencies` support (#12122) (`545d041`) - ci: Skip check-examples on fork PRs (#12124) (`259f153`) - fix: Stabilize flaky watch_file_change_reruns_affected_package test (#12123) (`09d6daa`) - fix: Microfrontends merges `with` into root config instead of replacing it (#12125) (`92018dc`) --------- Co-authored-by: Turbobot <turbobot@vercel.com>
Summary
In single-package mode (
is_monorepo: false), framework inference only checkedpackage_json.dependencies, missing frameworks installed asdevDependencies(e.g. Vite, Astro, SvelteKit). This caused incorrect or missing framework detection for many common setups.Root Cause
In
crates/turborepo-frameworks/src/lib.rs, theMatcher::testfunction usesunresolved_external_dependenciesfor monorepos (which includes all deps), but falls back to onlypackage_json.dependenciesfor single-package projects.Fix
When not in a monorepo, check both
dependenciesanddev_dependencieswhen looking up whether a framework dep is present.Test
Added a test case:
finds_vite_in_devdependencies_in_non_monorepo— verifies that Vite is detected when listed underdevDependenciesin single-package mode.All 15 tests pass.
Fixes #12023