News for hackers. Stuff that matters.
Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by junon on Sunday January 09, 2022 @09:18PM (#29869830)
Maintainer of Chalk[0][1] here, a very popular alternative to colors. Happy to help anyone that would like to port away from colors to chalk, or who might just have general questions about terminal colors.

Just reply here and I'll see them.

[0] https://GitHub.com/chalk/chalk

[1] https://npmjs.org/package/chalk

Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by folkhack on Sunday January 09, 2022 @10:03PM (#29870102)
I use the hell out of chalk and I just want to say thank you for creating/maintaining a solid product. Seeing this is scary to us who still unfortunately have dependencies with Node/npm.

Thank you so much for what you do.

Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by dimgl on Sunday January 09, 2022 @09:36PM (#29869937)
I love Chalk! I didn't realize it came after colors. Thanks for maintaining this package.
Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by pkgland on Monday January 10, 2022 @12:13AM (#29870915)
Not a question but just want to help developers who needs it: pkg.land (beta) finds similar packages on NPM.

Here are the links for colors and faker:

https://pkg.land/package/colors (chalk is top suggestion!)

https://pkg.land/package/faker

Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by DandyDev on Monday January 10, 2022 @02:46PM (#29880828)
This is very cool. Sad that it only works for NPM packages. Would love this for PyPI packages
Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by feupan on Sunday January 09, 2022 @09:40PM (#29869957)
Is a codemod available for anyone who wants to migrate?
Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by junon on Sunday January 09, 2022 @10:20PM (#29870208)
Not at the moment, but the migration should be pretty straightforward if you don't use the more elaborate color functions from `colors` (e.g. we don't have things like "zebra").

If you use `require('colors/safe')` and only use the basic colors, then Chalk is more or less a drop-in replacement.

If you use the property values (e.g. `"my string".green`) then you'll need to change that to `chalk.green("my string")`.

Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by jwalton on Sunday January 09, 2022 @10:53PM (#29870408)
One thing worth noting is that chalk 5 is ESM only, so if you’re using commonjs, you’ll need to use chalk 4, or transpire it with Babel, or something…
Re:Dev corrupts NPM libs 'colors' and 'faker', breaking thou... by mazlix on Monday January 10, 2022 @03:34AM (#29871956)
Never used colorjs, have used chalk in my OSS projects and love it. Guess now's a good time show appreciation to maintainers so thank you.