Summary
When installing dependencies for the new project with create-vinext-app, the output printed by pnpm loses its ANSI colors and is displayed as plain text.
The same pnpm commands normally produce colored output when run directly in a terminal, so the CLI appears to be preventing or stripping color output when spawning pnpm.
Reproduction
Start a new project with create-vinext-app
pnpm create vinext-app@latest test-app
Choose the project configurations and install the project dependencies, then you can see the pnpm output just loses its colors.
Expected behavior
Possible root cause
pnpm dependencies installing process is spawned by installDeps() with exec() function, and the stdio is set to inherit.
|
return ( |
|
(await exec(`${installCmd} ${depsStr}`, { |
|
cwd: root, |
|
stdio: "inherit", |
|
})) ?? "" |
However, exec() accepts the parameter stdio and just doesn't pass it to the spawn(). The stdio is actually hard-coded as ["inherit", "pipe", "pipe"].
|
const exec = |
|
options._exec ?? |
|
((cmd: string, opts: { cwd: string; stdio: string }) => |
|
new Promise<string>((resolve, reject) => { |
|
const child = spawn(cmd, { |
|
cwd: opts.cwd, |
|
shell: true, |
|
stdio: ["inherit", "pipe", "pipe"], |
|
}); |
Notes
The hard-coded pipe is for detecting approve builds error (related #2279). So fixing this issue can be quite tricky.
Summary
When installing dependencies for the new project with
create-vinext-app, the output printed by pnpm loses its ANSI colors and is displayed as plain text.The same pnpm commands normally produce colored output when run directly in a terminal, so the CLI appears to be preventing or stripping color output when spawning pnpm.
Reproduction
Start a new project with
create-vinext-appChoose the project configurations and install the project dependencies, then you can see the pnpm output just loses its colors.
Expected behavior
Possible root cause
pnpm dependencies installing process is spawned by
installDeps()withexec()function, and thestdiois set toinherit.vinext/packages/vinext/src/init.ts
Lines 356 to 360 in 056cd02
However,
exec()accepts the parameterstdioand just doesn't pass it to thespawn(). Thestdiois actually hard-coded as["inherit", "pipe", "pipe"].vinext/packages/vinext/src/init.ts
Lines 465 to 473 in 056cd02
Notes
The hard-coded
pipeis for detecting approve builds error (related #2279). So fixing this issue can be quite tricky.