Skip to content

refactor(@angular/cli): use Node.js styleText for color helpers - #33814

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:perf/use-styletext-color-helpers
Aug 10, 2026
Merged

refactor(@angular/cli): use Node.js styleText for color helpers#33814
clydin merged 1 commit into
angular:mainfrom
clydin:perf/use-styletext-color-helpers

Conversation

@clydin

@clydin clydin commented Aug 7, 2026

Copy link
Copy Markdown
Member

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.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Aug 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/angular/cli/src/utilities/color.ts
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 7, 2026
@clydin
clydin requested a review from alan-agius4 August 7, 2026 20:26
Comment thread packages/angular/cli/src/commands/update/utilities/migration.ts Outdated
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.
@clydin
clydin force-pushed the perf/use-styletext-color-helpers branch from a4a72a0 to 1c9b51c Compare August 10, 2026 13:55
@clydin
clydin requested a review from alan-agius4 August 10, 2026 13:56
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 10, 2026
@clydin
clydin merged commit f62a102 into angular:main Aug 10, 2026
40 checks passed
@clydin

clydin commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

This PR was merged into the repository. The changes were merged into the following branches:

@clydin
clydin deleted the perf/use-styletext-color-helpers branch August 10, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants