-
Notifications
You must be signed in to change notification settings - Fork 9
update check changes compare file #1585
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
update check changes compare file #1585
Conversation
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.
Pull Request Overview
This PR enhances a script for comparing React components between current state and a previous commit, adding better error handling, CLI argument parsing, and improved output formatting.
- Adds proper command-line argument parsing with
-dand--daysflags - Implements comprehensive error handling for git operations and file operations
- Enhances output formatting with colored console messages and structured comparison results
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const args = process.argv.slice(1); | ||
| const daysAgo = args [2]; | ||
| console.log(daysAgo); | ||
| const args = process.argv.slice(2); |
Copilot
AI
Sep 25, 2025
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.
The comment on line 5 indicates this was changed from slice(1) to slice(2), but process.argv.slice(2) is correct since process.argv[0] is the node executable and process.argv[1] is the script name. However, there's no validation that the script is being called correctly - if someone passes arguments in the old format, this will break.
| // const differences = diffChars(oldHtml, currentHtml); | ||
| // console.log(` Detailed differences:`, differences.filter(part => part.added || part.removed)); |
Copilot
AI
Sep 25, 2025
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 commented-out debugging code should be removed or made configurable through a verbose flag rather than left as commented code.
| Object.keys(currentComponents).forEach(componentName => { | ||
| const current = currentComponents[componentName]; | ||
| const old = oldComponents[componentName]; | ||
|
|
||
| try { |
Copilot
AI
Sep 25, 2025
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 only iterates over components that exist in the current version. Components that existed in the old version but were removed will not be detected. Consider using a Set of all component names from both versions to ensure removed components are reported.
| Object.keys(currentComponents).forEach(componentName => { | |
| const current = currentComponents[componentName]; | |
| const old = oldComponents[componentName]; | |
| try { | |
| // Create a set of all component names from both current and old | |
| const allComponentNames = new Set([ | |
| ...Object.keys(currentComponents), | |
| ...Object.keys(oldComponents) | |
| ]); | |
| allComponentNames.forEach(componentName => { | |
| const current = currentComponents[componentName]; | |
| const old = oldComponents[componentName]; | |
| try { | |
| if (!current && old) { | |
| console.log(`❌ ${componentName}: REMOVED`); | |
| changedCount++; | |
| return; | |
| } | |
| if (current && !old) { | |
| console.log(`🆕 ${componentName}: ADDED`); | |
| changedCount++; | |
| return; | |
| } |
7566526
into
uds-1663-check-element-changes
Description
Checklist
Important Reminders
Links