Skip to content

Conversation

@davidornelas11
Copy link
Contributor

Description

Checklist

  • Tests pass for relevant code changes

Important Reminders

Links

@davidornelas11 davidornelas11 requested a review from a team as a code owner September 25, 2025 21:56
Copy link
Contributor

Copilot AI left a 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 -d and --days flags
  • 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);
Copy link

Copilot AI Sep 25, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +218 to +219
// const differences = diffChars(oldHtml, currentHtml);
// console.log(` Detailed differences:`, differences.filter(part => part.added || part.removed));
Copy link

Copilot AI Sep 25, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +187 to +191
Object.keys(currentComponents).forEach(componentName => {
const current = currentComponents[componentName];
const old = oldComponents[componentName];

try {
Copy link

Copilot AI Sep 25, 2025

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.

Suggested change
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;
}

Copilot uses AI. Check for mistakes.
@davidornelas11 davidornelas11 merged commit 7566526 into uds-1663-check-element-changes Sep 30, 2025
1 check failed
@davidornelas11 davidornelas11 deleted the uds-1663-updated-dave branch September 30, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants