Skip to content

fix(frameworks): Also check devDependencies when inferring framework in single-package mode#12056

Merged
anthonyshew merged 3 commits intovercel:mainfrom
sleitor:fix/framework-inference-dev-dependencies
Mar 3, 2026
Merged

fix(frameworks): Also check devDependencies when inferring framework in single-package mode#12056
anthonyshew merged 3 commits intovercel:mainfrom
sleitor:fix/framework-inference-dev-dependencies

Conversation

@sleitor
Copy link
Contributor

@sleitor sleitor commented Feb 28, 2026

Summary

In single-package mode (is_monorepo: false), framework inference only checked package_json.dependencies, missing frameworks installed as devDependencies (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, the Matcher::test function uses unresolved_external_dependencies for monorepos (which includes all deps), but falls back to only package_json.dependencies for single-package projects.

Fix

When not in a monorepo, check both dependencies and dev_dependencies when 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 under devDependencies in single-package mode.

All 15 tests pass.

Fixes #12023

…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 sleitor requested a review from a team as a code owner February 28, 2026 02:34
@sleitor sleitor requested review from tknickman and removed request for a team February 28, 2026 02:34
@vercel
Copy link
Contributor

vercel bot commented Feb 28, 2026

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

A member of the Team first needs to authorize it.

@anthonyshew
Copy link
Contributor

Can you explain why there are two of these? #12038

@sleitor
Copy link
Contributor Author

sleitor commented Mar 3, 2026

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 anthonyshew changed the title fix(frameworks): also check devDependencies when inferring framework in single-package mode fix(frameworks): Also check devDependencies when inferring framework in single-package mode Mar 3, 2026
Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

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

Thanks! I'll add some more test coverage in a follow-up PR.

@vercel
Copy link
Contributor

vercel bot commented Mar 3, 2026

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

Project Deployment Actions Updated (UTC)
examples-basic-web Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-designsystem-docs Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-gatsby-web Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-kitchensink-blog Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-nonmonorepo Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-svelte-web Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-tailwind-web Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
examples-vite-web Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
turbo-site Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm
turborepo-agents Ready Ready Preview, Comment, Open in v0 Mar 3, 2026 2:00pm

@anthonyshew
Copy link
Contributor

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.

@anthonyshew anthonyshew merged commit cb12132 into vercel:main Mar 3, 2026
39 of 53 checks passed
anthonyshew added a commit that referenced this pull request Mar 3, 2026
…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).
github-actions bot added a commit that referenced this pull request Mar 3, 2026
## 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>
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.

Framework inference ignores devDependencies in single-package projects

2 participants