Humble CLI command that print its arguments in red and exits with a non-zero code. Might be useful for showing more descriptive error messages when npm
scripts fail. Compatible with Node.js >= 4
.
npm i -g red-error
No install required, just run from any folder:
npx red-error I will exit with this message in red
Keep in mind that in order to use npx
with Node.js < 8
you need to either install npx
globally:
npm i -g npx
or update your version of npm
:
npm i -g npm
Install with npm / Yarn:
npm i -D red-error
Here's an example of one possible usage in an npm
script for checking formatting with Prettier:
{
"scripts": {
"format": "prettier --write *.js",
"format:check": "prettier --list-different *.js || red-error Code not formatted, use npm run format and try again",
}
}
Red Error is MIT licensed. See LICENSE.