Skip to content

Replace Chalk with ansis for better performance and tree-shaking#2592

Closed
Copilot wants to merge 3 commits intocanaryfrom
copilot/replace-chalk-with-ansis
Closed

Replace Chalk with ansis for better performance and tree-shaking#2592
Copilot wants to merge 3 commits intocanaryfrom
copilot/replace-chalk-with-ansis

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 8, 2025

This PR replaces the chalk dependency with ansis in the create-catalyst package for improved performance and better tree-shaking support.

Changes Made

  • Dependency Update: Replaced chalk@^5.4.1 with ansis@^4.1.0 in packages/create-catalyst/package.json
  • Import Modernization: Updated all import statements to use named imports from ansis for better tree-shaking:
    - import chalk from 'chalk';
    + import { red, green, yellow, bold, dim, cyan, cyanBright } from 'ansis';
  • Method Call Updates: Updated all method calls throughout the codebase:
    - chalk.red('Error message')
    + red('Error message')
    
    - chalk.bold(chalk.green('Success'))
    + bold(green('Success'))

Benefits

  • Performance: ansis is significantly faster than chalk with zero dependencies
  • Bundle Size: Better tree-shaking support reduces bundle size by only importing used color functions
  • Compatibility: ansis provides 100% API compatibility with chalk, ensuring no behavioral changes
  • Modern: ansis is actively maintained and designed for modern Node.js environments

Files Updated

  • src/commands/create.ts - CLI create command color output
  • src/commands/init.ts - CLI init command color output
  • src/index.ts - Main CLI header styling
  • src/utils/install-dependencies.ts - Error message styling
  • src/utils/login.ts - Authentication flow styling
  • src/utils/telemetry/index.ts - Telemetry status styling
  • src/prompts/multi-select/helpers.ts - Interactive prompt styling

Testing

  • ✅ All existing tests pass
  • ✅ TypeScript compilation succeeds
  • ✅ ESLint passes with zero warnings
  • ✅ CLI functionality verified with identical colored output
  • ✅ Build process completes successfully

The CLI maintains the exact same visual appearance and functionality while benefiting from improved performance and modern dependency management.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.segment.io
    • Triggering command: node /home/REDACTED/work/catalyst/catalyst/packages/create-catalyst/dist/index.js telemetry (dns block)
  • googlechromelabs.github.io
    • Triggering command: node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: node install.mjs (http block)
  • https://storage.googleapis.com/chrome-for-testing-public/137.0.7151.55/linux64/chrome-linux64.zip
    • Triggering command: node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 8, 2025

⚠️ No Changeset found

Latest commit: bc4ed6d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Sep 8, 2025 6:03pm
catalyst-canary Ready Ready Preview Comment Sep 8, 2025 6:03pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Sep 8, 2025 6:03pm
catalyst-au Ignored Ignored Sep 8, 2025 6:03pm
catalyst-uk Ignored Ignored Sep 8, 2025 6:03pm

Co-authored-by: bookernath <8922457+bookernath@users.noreply.github.com>
…shaking

Co-authored-by: bookernath <8922457+bookernath@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants