fix(cli): ensure install_deps runs in correct project directory#18019
Conversation
|
""" Walkthrough本次更改将依赖安装函数 Changes
Sequence Diagram(s)sequenceDiagram
participant Project
participant Utils
Project->>Utils: install_deps(npm, project_path, cb)
Utils->>Utils: set_current_dir(project_path)
Utils->>Utils: 执行依赖安装命令
Utils->>Project: 调用回调 cb
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes identified. Poem
""" Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18019 +/- ##
=======================================
Coverage 54.99% 54.99%
=======================================
Files 417 417
Lines 21696 21696
Branches 5361 5365 +4
=======================================
Hits 11931 11931
+ Misses 8116 8081 -35
- Partials 1649 1684 +35
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
24c86c7 to
86a6702
Compare
这个 PR 做了什么? (简要描述所做更改)
错误原因
install_deps函数没有确保在正确的项目目录中执行包管理器命令,导致pnpm install无法找到package.json文件,从而失败解决方案
修改
install_deps函数:project_path: &str参数env::set_current_dir(project_path)切换到项目目录更新函数调用:
project.rs中调用install_deps时传入项目路径参数验证步骤
结果
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit