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

Fix asset build throwing and swallowing errors #721

Merged

Conversation

MadLittleMods
Copy link
Contributor

Fix asset build throwing and swallowing errors

  • Fix svg-colorizer throwing errors with Windows file paths
  • Fix css-url-parser swallowing errors because it was async
  • Fail SDK build script (yarn build:sdk, build.sh) overall when some commands are failing

 - Fix `svg-colorizer` throwing errors on Windows
 - Fix `css-url-parser` swallowing errors
 - Fail SDK build script when some commands are failing
@MadLittleMods MadLittleMods added the bug Something isn't working label Apr 19, 2022
@@ -37,7 +37,7 @@ module.exports.buildColorizedSVG = function (svgLocation, primaryColor, secondar
if (svgCode === coloredSVGCode) {
throw new Error("svg-colorizer made no color replacements! The input svg should only contain colors #ff00ff (primary, case-sensitive) and #00ffff (secondary, case-sensitive).");
}
const fileName = svgLocation.match(/.+\/(.+\.svg)/)[1];
const fileName = svgLocation.match(/.+[/\\](.+\.svg)/)[1];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Account for Windows file paths which use back slashes.

@@ -39,7 +39,7 @@ function colorsFromURL(url, colorMap) {
function processURL(decl, replacer, colorMap) {
const value = decl.value;
const parsed = valueParser(value);
parsed.walk(async node => {
parsed.walk(node => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was previously marked as async but await was never used here so it wasn't necessary. And had the side-effect of swallowing any error that occurred within the plugin so it looked like the asset build succeeded even though it didn't (UnhandledPromiseRejectionWarning: Unhandled promise rejection.).

@@ -1,4 +1,8 @@
#!/bin/bash
# Exit whenever one of the commands fail with a non-zero exit code
set -e
set -o pipefail
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the comment describes: Exit whenever one of the commands fail with a non-zero exit code

Copy link
Contributor

@MidhunSureshR MidhunSureshR left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@MadLittleMods MadLittleMods merged commit 5f8a171 into master Apr 20, 2022
@MadLittleMods
Copy link
Contributor Author

Thanks for the review @MidhunSureshR 🐇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants