highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

refactor(tools): replace @colors/colors with smaller and faster ansis

Open webdiscus opened this issue 1 year ago • 0 comments

This PR replaces @colors/colors used in CLI tools with smaller and faster ansis.

Benefits of ansis

Packages that already use ansis

facebook/stylex, nestjs/nest, sequelize/core, oclif/core, salesforcecli/cli and thousands others

Changes

The changes in CLI tools:

  • replace @colors/colors with ansis
  • add color preview for selectors used in CSS
  • fix ESLint errors in tools code

Checklist

  • [ ] Added markup tests, or they don't apply here because...
  • [ ] Updated the changelog at CHANGES.md

Test

This PR does not require unit/integration tests, but you can do the manual test.

Clone and install the forked repository:

git clone https://github.com/webdiscus/ansis-highlight.js.git
cd ansis-highlight.js
git checkout switch-to-ansis
npm i
npm run build

1) Run CheckTheme tools in CLI

For example, we want to check the vs2015 style:

node ./tools/checkTheme.js ./src/styles/vs2015.css

In console output will be displayed color text and NEW added preview of colors used in CSS selectors: high fidelity highlighting (this is optional)

2) Run CheckAutoDetect tools in CLI

node ./tools/checkAutoDetect.js

In console output will be displayed color text:

Pasted Graphic

webdiscus avatar Jan 01 '25 14:01 webdiscus