-
Notifications
You must be signed in to change notification settings - Fork 123
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
Fix asset build throwing and swallowing errors #721
Conversation
- Fix `svg-colorizer` throwing errors on Windows - Fix `css-url-parser` swallowing errors - Fail SDK build script when some commands are failing
@@ -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]; |
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.
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 => { |
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 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 |
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.
As the comment describes: Exit whenever one of the commands fail with a non-zero exit code
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.
lgtm 👍
Thanks for the review @MidhunSureshR 🐇 |
Fix asset build throwing and swallowing errors
svg-colorizer
throwing errors with Windows file pathscss-url-parser
swallowing errors because it wasasync
yarn build:sdk
,build.sh
) overall when some commands are failing