-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
fix(scripts): add error handling to verify-treeshaking script #13192
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: main
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
WalkthroughThe script for verifying treeshaking was reformatted to use a multi-line promise chain with explicit Changes
Poem
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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 (
|
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)
scripts/verify-treeshaking.js (1)
45-49
: Consider including file paths in error messages.While the error throwing logic works correctly, it could be improved by including the paths of the files that were checked in the error message. This would make it easier to debug issues, especially for new contributors.
if (errors.length) { throw new Error( - `Found the following treeshaking errors:\n\n- ${errors.join('\n\n- ')}`, + `Found the following treeshaking errors in packages/vue/dist/vue.runtime.global.js and packages/vue/dist/vue.runtime.global.prod.js:\n\n- ${errors.join('\n\n- ')}`, ) }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/verify-treeshaking.js
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
scripts/verify-treeshaking.js (2)
scripts/utils.js (1)
exec
(64-114)packages/compiler-sfc/src/script/context.ts (1)
error
(153-157)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (2)
scripts/verify-treeshaking.js (2)
5-6
: Good improvement to error handling!The restructuring of this script to use a proper Promise chain with
.then()
and.catch()
blocks adds essential error handling that was missing before. This will properly catch and report failures during the build process, improving the developer experience.Also applies to: 50-54
51-54
: Clear error reporting and process termination.The error handling implementation follows best practices:
- Descriptive error message that includes the original error details
- Process exits with code 1 to signal failure to CI/CD systems
This will help developers quickly identify and fix issues when the treeshaking verification fails.
This PR adds basic error handling to the verify-treeshaking.js script to ensure build failures are properly caught and reported.
Summary by CodeRabbit