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

build(sample): replace cli-color with smaller and faster ansis #14155

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

webdiscus
Copy link
Contributor

@webdiscus webdiscus commented Nov 17, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

no changes

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This PR replaces the cli-color package with smaller, faster, TypeScript-friendly ansis.

Benefits of ansis

  • Installed package size is smaller: ansis 11 KB (no dependencies) vs cli-color 754 KB (5 dependencies)
    see Compare the size of most popular packages
  • 20x faster than cli-color, see Benchmarks
  • Supports Bun and Deno runtimes
  • Fallback to supported color space: TrueColor → 256 colors → 16 colors → no colors
  • Supports environment variables NO_COLOR FORCE_COLOR and flags --no-color --color
  • Supports named import: import { red, green, bold, ansi256, hex } from 'ansis'
  • Zero dependencies
  • TypeScript-friendly
  • 100% test coverage

Packages that already use ansis

Test

This PR does not require unit/integration tests.

But you can do the manual test:

git clone https://github.com/webdiscus/nestjs.git
cd nestjs
git checkout cli-color-to-ansis
yarn

npm run build:samples

In console output will be displayed color text:

image

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4eeeb606-44b7-4776-ae6e-4935aa4f1060

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.239%

Totals Coverage Status
Change from base Build 95985be7-9efe-4fbc-a74d-96ea385a9b6d: 0.0%
Covered Lines: 6774
Relevant Lines: 7344

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec added type: build dependencies Pull requests that update a dependency file labels Nov 18, 2024
@kamilmysliwiec kamilmysliwiec merged commit 27193cc into nestjs:master Nov 18, 2024
3 checks passed
@kamilmysliwiec
Copy link
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file type: build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants