refactor(@angular/cli): use Node.js styleText for color helpers - #33814
Open
clydin wants to merge 1 commit into
Open
refactor(@angular/cli): use Node.js styleText for color helpers#33814clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
Replaces listr2 re-exports in the CLI color helper with Node.js built-in `styleText` utilities from `node:util`. Previously, importing colors from `utilities/color.ts` eagerly pulled in `listr2` along with its transitive dependencies (`wrap-ansi`, `string-width`, `get-east-asian-width`), introducing synchronous ESM module evaluation and ANSI formatting overhead during early CLI startup.
There was a problem hiding this comment.
Code Review
This pull request replaces the dependency on listr2 for terminal coloring in packages/angular/cli/src/utilities/color.ts with a custom implementation using Node's native styleText from node:util. However, using styleText directly introduces compatibility issues with older Node.js versions supported by Angular CLI and fails to respect color support detection in non-TTY environments. It is recommended to implement a fallback mechanism and wrap the formatting calls to conditionally apply colors based on terminal support.
alan-agius4
reviewed
Aug 8, 2026
| FileSystemSchematicDescription, | ||
| NodeWorkflow, | ||
| } from '@angular-devkit/schematics/tools'; | ||
| import { color as colors, figures } from 'listr2'; |
Collaborator
There was a problem hiding this comment.
For constancy shouldn't this be using the internal color util?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces listr2 re-exports in the CLI color helper with Node.js built-in
styleTextutilities fromnode:util.Previously, importing colors from
utilities/color.tseagerly pulled inlistr2along with its transitive dependencies (wrap-ansi,string-width,get-east-asian-width), introducing synchronous ESM module evaluation and ANSI formatting overhead during early CLI startup.