-
Notifications
You must be signed in to change notification settings - Fork 85
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
chore(mako): add debug notice for local builds #1743
Conversation
概述步骤说明本次变更主要涉及 变更
序列图sequenceDiagram
participant Dev as 开发者
participant Mako as Mako构建系统
participant Console as 控制台
Dev->>Mako: 触发本地构建
Mako->>Console: 使用 chalk 打印调试信息
Console-->>Dev: 显示本地构建调试消息
诗歌
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
WalkthroughThis pull request introduces a debug notice for local builds in the Mako package. When Mako is not running from the Changes
|
// if mako is running in local build, print a notice | ||
if (!__dirname.includes('node_modules')) { | ||
console.log( | ||
chalk.red('NOTICE: Mako is running in DEBUG mode with local build...'), |
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.
Ensure that using chalk.red
for the debug notice is appropriate for your use case, as it might be interpreted as an error message. Consider using a different color if the notice is informational.
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/mako/src/index.ts (1)
46-51
: 建议改进调试通知的实现方式当前实现可以考虑以下几点改进:
- 使用环境变量来控制调试模式会比检查
__dirname
更灵活- 可以添加更多有用的调试信息,如当前的构建配置等
建议参考以下实现:
- if (!__dirname.includes('node_modules')) { + if (process.env.DEBUG || !__dirname.includes('node_modules')) { console.log( - chalk.red('NOTICE: Mako is running in DEBUG mode with local build...'), + chalk.red( + `NOTICE: Mako is running in DEBUG mode with local build... + - Build Path: ${__dirname} + - Node Version: ${process.version} + - Config: ${JSON.stringify(params.config, null, 2)}` + ), ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/mako/src/index.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: stable - i686-pc-windows-msvc - node@20
- GitHub Check: stable - x86_64-pc-windows-msvc - node@20
- GitHub Check: Clippy
- GitHub Check: stable - aarch64-unknown-linux-musl - node@20
- GitHub Check: Mako Build (macos-latest)
- GitHub Check: stable - aarch64-unknown-linux-gnu - node@20
- GitHub Check: stable - x86_64-unknown-linux-musl - node@20
- GitHub Check: stable - x86_64-unknown-linux-gnu - node@20
- GitHub Check: Cargo Test
- GitHub Check: Code Coverage
- GitHub Check: Mako Build (ubuntu-latest)
- GitHub Check: stable - aarch64-apple-darwin - node@20
- GitHub Check: stable - x86_64-apple-darwin - node@20
🔇 Additional comments (1)
packages/mako/src/index.ts (1)
4-4
: 导入语句看起来不错!
chalk
库的引入适合用于控制台消息的样式设置。
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1743 +/- ##
=======================================
Coverage 54.80% 54.81%
=======================================
Files 180 180
Lines 18079 18079
=======================================
+ Hits 9909 9910 +1
+ Misses 8170 8169 -1 ☔ View full report in Codecov by Sentry. |
.
Summary by CodeRabbit
新功能
开发者体验