maizzle / framework

Quickly build HTML emails with Tailwind CSS.
https://maizzle.com
MIT License
1.23k stars 49 forks source link

Exit code is not properly set when template compilation failed #1255

Closed wenjie-mo closed 5 months ago

wenjie-mo commented 6 months ago

Hello,

I find that the exit code will be set to zero even if there is an compilation failure across templates:

Log:

$ maizzle build production
✖ Failed to compile template: promotional.html
⚠ [components] <x-notExist> could not find notExist.html in the defined root paths (src/components, src/layouts, src/templates)
✔ Built 0 templates in 0.16s
✨  Done in 0.74s.

When I echo the exit code, it is zero.

I followed the #986, however the error code is always zero regardless of which config.build.fail I choose (verbose, silent or unset). I would like Maizzle to fail so the CI can detect it.

Thanks so much for the help!

cossssmin commented 5 months ago

Right, so the problem is here:

https://github.com/maizzle/framework/blob/659e2a47ed2584153fd4fbc93d176387bac885ad/src/generators/output/to-disk.js#L239

We should just throw in that case, i.e.:

- .catch(error => spinner.warn(error.message))
+ .catch(error => {
+   throw error
+ })

I'll try to release a fix this week, thanks for bringing it up 👍

wenjie-mo commented 5 months ago

Thank you so much Cosmin, appreciate the help!