Hello, I had a question about build log errors and something I saw in this post :
Don’t name your build command build
Does this mean we shouldn’t be doing npm run build
to do builds? I was wondering since I wanted to have an ESLint and Prettier check and fail if code is not formatted properly. It currently looks like this:
"build": "npm run format:check && gatsby build"
This currently works, but the message is buried inside the rest of the npm error logs and is not easy to find for someone new who is doing a pull request on my project and checking the log.
Is there a better way to pretty print error messages so that stand out? I have tried doing multi-line echo
calls by doing something like this (simplified):
"format:check": "prettier --check || echo Have you formatted your code? Try running \n echo ' npm run format'"
This works for the most part, but the error message will appear during the initial call of the script, and a second time when it actually happens, and that can be confusing.
What is the best way to approach build log error messages?