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

Use pretty colors in the output? #18

Closed
JoshuaKGoldberg opened this issue Nov 29, 2017 · 3 comments
Closed

Use pretty colors in the output? #18

JoshuaKGoldberg opened this issue Nov 29, 2017 · 3 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

https://github.com/chalk/chalk can do it for you, though if you want just an angry red & bold color it's easy to do inline.

I'd be willing to send a PR too!

@JoshuaKGoldberg
Copy link
Contributor Author

In a little more detail: this is what I get from putting it in a nested package.json script:

    // ...
    "setup": "npm run setup:engines && npm run setup:script",
    "setup:engines": "check-node-version --node 9",
    "setup:script": "node scripts/setup.js",
    // ...
C:\Code\MyRepo (bugfix/hard-package-versions)
λ npm run setup

> [email protected] setup C:\Code\MyRepo
> npm run setup:engines && npm run setup:script

npm WARN invalid config loglevel="notice"

> [email protected] setup:engines C:\Code\MyRepo
> check-node-version --node 9

node: 8.8.1
Error: Wanted node version 9 (>=9.0.0 <10.0.0)
To install node, run `nvm install 9` or see https://nodejs.org/

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Code\\MyRepo\\node_modules\\npm\\bin\\npm-cli.js" "run" "setup:engines"
npm ERR! node v8.8.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] setup:engines: `check-node-version --node 9`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] setup:engines script 'check-node-version --node 9'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electric-boogaloo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     check-node-version --node 9
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs electric-boogaloo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls electric-boogaloo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Code\MyRepo\npm-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] setup: `npm run setup:engines && npm run setup:script`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] setup script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jogol\AppData\Roaming\npm-cache\_logs\2017-11-29T00_29_33_449Z-debug.log

Someone with a very old Node version might not see the actual error. In fact, that happened earlier today with a teammate of mine.

@parshap
Copy link
Owner

parshap commented Nov 29, 2017

Yes, this would be great and I would greatly appreciate a PR for this! @paulmelnikow suggested this in #15 too. Using chalk sounds good to me, especially since it checks for a tty before enabling colors.

@paulmelnikow
Copy link
Contributor

Woohoo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants