refactor(cli): replace styleText with picocolors#1950
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 67d810519d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 064251a101
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,4 +1,4 @@ | |||
| import { styleText } from 'node:util'; | |||
| import colors from 'picocolors'; | |||
There was a problem hiding this comment.
Preserve non-TTY color suppression
With the default picocolors export, color support is computed from environment variables and treats CI=true as color-capable even when stdout is not a TTY; styleText() previously returned plain text in that same non-TTY CI case unless color was explicitly forced. For invocations such as CI=true vp create ... > log without NO_COLOR, these shared helpers now inject ANSI escapes into captured output, which changes the documented no-behavior-change refactor and can break log/snapshot consumers. Consider creating a local colors wrapper with the previous stream/TTY gating instead of using the default export directly.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This does bring a behavior change, but I think it should be treated as an improvement.
In Rust side, we use owo_colors which emits ANSI chars, the same behavior as Vite, who has already used picocolors for a long time. So use default picocolors exports can help create more united mental model.
|
@liangmiQwQ may be worth adding a small regression snap test to check that imports the JS CLI entry under a Node version older than 20.12, since the original failure happens during module loading rather than command execution. |
|
Well... there are upstream dependencies using So, the only tiny value this PR has left is #1950 (comment), I will modify the PR description, you can decide to close or merge this PR. |
|
@liangmiQwQ Just as I expected, after all, many of our dependencies no longer support older versions of Node.js. |
Close #1947
This PR replaces JS CLI uses of
node:utilstyleTextwithpicocolors, matching Rust and Vite side's CI behavior.It updates create, migrate, terminal, help, editor, agent, and tsconfig prompt formatting, plus the CLI output polish RFC reference.
🤖 Generated with Codex