-
Notifications
You must be signed in to change notification settings - Fork 94
Update icon definitions script #844
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: master
Are you sure you want to change the base?
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 fixes a bug in the icon definitions script where icons were being accumulated into an ever-expanding array instead of a set, causing duplicate entries. The script has also been refactored from asynchronous to synchronous execution for debugging purposes.
- Fix icon accumulation logic by using Set instead of array concatenation
- Refactor from async/await to synchronous file operations
- Improve code organization and documentation
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// /*! iconNames: ['far fa-copy', 'fas fa-link', 'fab fa-github', 'fas fa-terminal', 'fal fa-external-link-alt'] */ | ||
|
||
let contents = fs.readFileSync(iconDefsFile, 'utf8') | ||
let firstLine = contents.substr(0, contents.indexOf("\n")); |
Copilot
AI
Sep 8, 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.
Use substring()
instead of the deprecated substr()
method. Replace with contents.substring(0, contents.indexOf('\n'))
.
let firstLine = contents.substr(0, contents.indexOf("\n")); | |
let firstLine = contents.substring(0, contents.indexOf("\n")); |
Copilot uses AI. Check for mistakes.
if (contents.includes(ICON_SIGNATURE_CS)) { | ||
return contents.toString() | ||
.match(ICON_RX) | ||
.map((it) => it.substr(10)) |
Copilot
AI
Sep 8, 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.
Use substring()
instead of the deprecated substr()
method. Replace with it.substring(10)
.
.map((it) => it.substr(10)) | |
.map((it) => it.substring(10)) |
Copilot uses AI. Check for mistakes.
|
||
try { | ||
const requiredIconNames = JSON.parse(firstLine.match(REQUIRED_ICON_NAMES_RX)[1].replace(/'/g, '"')) | ||
console.log(requiredIconNames) |
Copilot
AI
Sep 8, 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.
Remove this debug console.log statement as it appears to be leftover from debugging and should not be in production code.
console.log(requiredIconNames) |
Copilot uses AI. Check for mistakes.
Fix populate-icon-definitions by adding definitions to set rather than ever-expanding array.
This might not be the final version of work (as part of understanding and debugging the script, I changed it from async to sync... though on the other hand, it only takes < 10 seconds for the full Staging build, so it isn't unthinkable)