-
Notifications
You must be signed in to change notification settings - Fork 30.4k
fix(agents-md): use require.resolve() to get the installed next version
#89166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
fix(agents-md): use require.resolve() to get the installed next version
#89166
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Tests Passed |
| if (nextVersion) { | ||
| const cleanVersion = nextVersion.replace(/^[\^~>=<]+/, '') | ||
| return { version: cleanVersion } | ||
| const nextPkgPath = require.resolve('next/package.json', { paths: [cwd] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is smart. only part that's missing is the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also need to update findNextjsInWorkspace to this logic
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **432 kB** → **432 kB** ✅ -42 B81 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
|
86b2567 to
93cb357
Compare
Instead of parsing version ranges from package.json dependencies, use `require.resolve` to find the actual installed `next/package.json` and read the version directly. This provides the exact installed version rather than the specified version range, making version detection more accurate.
93cb357 to
8c2ad1f
Compare

Why?
When the package.json has Next.js version with a tag instead of a specific version, e.g.,
"next": "canary", it received an error:How?
Modified logic to get version to use
require.resolve().Before
CleanShot.2026-01-28.at.12.32.51.mp4
After
CleanShot.2026-01-28.at.14.20.55.mp4