Skip to content
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

Tweak check-icons.js #1660

Merged
merged 4 commits into from
Mar 28, 2023
Merged

Tweak check-icons.js #1660

merged 4 commits into from
Mar 28, 2023

Conversation

XhmikosR
Copy link
Member

@XhmikosR XhmikosR commented Mar 27, 2023

  • return early
  • use path.basename and path.extname
  • replace require with fs.readFile
  • move variables

@korki43 could you check this one too please? https://github.com/twbs/icons/pull/1660/files?w=1

* return early
* use `path.basename` and `path.extname`
@XhmikosR XhmikosR added the build label Mar 27, 2023
Copy link
Contributor

@korki43 korki43 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I like the early return statement.

Copy link
Contributor

@korki43 korki43 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could pull the process.exit() out of the if-statements, so it doesn't stop after only showing the wrong icons in the JSON file. Theoretically you could also replace it with a throw statement, like in my original PR, but I don't see the advantages to logging an additional error after already showing the wrong icons.

@XhmikosR
Copy link
Member Author

You could pull the process.exit() out of the if-statements, so it doesn't stop after only showing the wrong icons in the JSON file.

You might be right there, it maybe make more to just exit at the end once with process.exit(1). I will try it, thanks :)

Theoretically you could also replace it with a throw statement, like in my original PR, but I don't see the advantages to logging an additional error after already showing the wrong icons.

Yeah, that didn't work, unfortunately that's why I removed it.

If you make any progress feel free to PR, thanks! :)

@XhmikosR XhmikosR marked this pull request as ready for review March 28, 2023 05:47
@XhmikosR XhmikosR merged commit 5725c41 into main Mar 28, 2023
@XhmikosR XhmikosR deleted the xmr/check-icons branch March 28, 2023 05:49
@XhmikosR XhmikosR changed the title Update check-icons.js Further* return early * use path.basename and path.extname * replace require with fs.readFile * move variablesTweak check-icons.js Mar 28, 2023
@XhmikosR XhmikosR changed the title Further* return early * use path.basename and path.extname * replace require with fs.readFile * move variablesTweak check-icons.js Tweak check-icons.js Mar 28, 2023
@XhmikosR
Copy link
Member Author

I replaced require with fs.readFile since the former doesn't work with modules (not that we will switch anytime soon, but it's future-proof 🙂)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants