refactor: migrate nypm to package-manager-detector#951
Conversation
Replace nypm with package-manager-detector for package manager detection, reducing bundled code size. package-manager-detector is a lighter, more focused package that provides the same detection capability. Since inlineDependencies is enabled, this removes unnecessary bundled functionality. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR replaces the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/devtools/src/server-rpc/npm.ts (1)
35-35:⚠️ Potential issue | 🟠 MajorFix yarn version detection to handle undefined version safely.
The
versionproperty onDetectResultis optional (version?: string). When it's undefined,!agent?.version?.startsWith('1.')evaluates totrue, causing yarn without a detected version to be treated as yarn berry and incorrectly omit--ignore-scripts. Add a fallback to safely include the flag when version is undefined:(name === 'yarn' && agent?.version && !agent.version.startsWith('1.')) ? '' : '--ignore-scripts',This ensures the flag is included by default unless we can confirm it's yarn berry (v2+).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/devtools/src/server-rpc/npm.ts` at line 35, The yarn version check treats undefined agent.version as Yarn Berry; update the conditional that builds the npm args so it only treats yarn as Berry when a version string exists and does not start with "1." — change the expression involving name, agent and version (the ternary that currently uses (name === 'yarn' && !agent?.version?.startsWith('1.')) ? '' : '--ignore-scripts') to require agent?.version before calling startsWith, so '--ignore-scripts' is included by default unless agent.version is present and indicates v2+.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/devtools/src/server-rpc/npm.ts`:
- Line 35: The yarn version check treats undefined agent.version as Yarn Berry;
update the conditional that builds the npm args so it only treats yarn as Berry
when a version string exists and does not start with "1." — change the
expression involving name, agent and version (the ternary that currently uses
(name === 'yarn' && !agent?.version?.startsWith('1.')) ? '' :
'--ignore-scripts') to require agent?.version before calling startsWith, so
'--ignore-scripts' is included by default unless agent.version is present and
indicates v2+.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f9e8ed61-73eb-49ab-836d-68cee75edc12
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
packages/devtools/package.jsonpackages/devtools/src/server-rpc/npm.tspnpm-workspace.yaml
Summary
Replace
nypmwithpackage-manager-detectorfor package manager detection. This reduces bundled code size sincepackage-manager-detectoris a lighter, more focused package that provides the same detection capability without unnecessary install/uninstall/update operations.Changes:
packages/devtools/src/server-rpc/npm.tspackages/devtools/package.jsoninlinedcatalog topnpm-workspace.yamlfor bundled dependencies🤖 Generated with Claude Code