Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): improve output color consistency across terminal themes #9133

Merged
merged 1 commit into from Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -13,6 +13,9 @@ import { prettyTime } from './pretty-time';
* are added. It is therefore intended for use on a user's local machines.
*
* In CI environments the static equivalent of this life cycle should be used.
*
* NOTE: output.dim() should be preferred over output.colors.gray() because it
* is much more consistently readable across different terminal color themes.
*/
export async function createRunManyDynamicOutputRenderer({
projectNames,
Expand Down Expand Up @@ -114,7 +117,7 @@ export async function createRunManyDynamicOutputRenderer({
output.colors.green(figures.tick) +
output.dim(' nx run ') +
task.id
} ${output.colors.gray('[local cache]')}`
} ${output.dim('[local cache]')}`
);
if (isVerbose) {
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
Expand All @@ -126,9 +129,7 @@ export async function createRunManyDynamicOutputRenderer({
output.colors.green(figures.tick) +
output.dim(' nx run ') +
task.id
} ${output.colors.gray(
'[existing outputs match the cache, left as is]'
)}`
} ${output.dim('[existing outputs match the cache, left as is]')}`
);
if (isVerbose) {
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
Expand All @@ -140,7 +141,7 @@ export async function createRunManyDynamicOutputRenderer({
output.colors.green(figures.tick) +
output.dim(' nx run ') +
task.id
} ${output.colors.gray('[remote cache]')}`
} ${output.dim('[remote cache]')}`
);
if (isVerbose) {
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
Expand All @@ -154,7 +155,7 @@ export async function createRunManyDynamicOutputRenderer({
output.colors.green(figures.tick) +
output.dim(' nx run ') +
task.id +
output.dim.gray(` (${timeTakenText})`)
output.dim(` (${timeTakenText})`)
);
if (isVerbose) {
writeCommandOutputBlock(tasksToTerminalOutputs[task.id]);
Expand Down Expand Up @@ -241,7 +242,7 @@ export async function createRunManyDynamicOutputRenderer({
additionalFooterRows.push(
` ${output.colors.green(
figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.colors.gray(
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]`
)}`
);
Expand Down Expand Up @@ -344,7 +345,7 @@ export async function createRunManyDynamicOutputRenderer({
];
if (totalCachedTasks > 0) {
pinnedFooterLines.push(
output.colors.gray(
output.dim(
`${EOL} Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`
)
);
Expand Down Expand Up @@ -385,9 +386,9 @@ export async function createRunManyDynamicOutputRenderer({
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
` ${output.colors.gray(
` ${output.dim(
figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.colors.gray(
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]`
)}`,
],
Expand Down
Expand Up @@ -25,6 +25,9 @@ type State =
* are added. It is therefore intended for use on a user's local machines.
*
* In CI environments the static equivalent of this life cycle should be used.
*
* NOTE: output.dim() should be preferred over output.colors.gray() because it
* is much more consistently readable across different terminal color themes.
*/
export async function createRunOneDynamicOutputRenderer({
initiatingProject,
Expand Down Expand Up @@ -154,10 +157,10 @@ export async function createRunOneDynamicOutputRenderer({

if (totalSuccessfulTasks > 0) {
linesToRender.push(
output.colors.gray(
` ${output.colors.gray(
output.dim(
` ${output.dim(
figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output.colors.gray.dim(
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output.dim(
`[${totalCachedTasks} read from cache]`
)}`
)
Expand Down Expand Up @@ -195,9 +198,9 @@ export async function createRunOneDynamicOutputRenderer({
if (totalDependentTasksNotFromInitiatingProject > 0) {
output.addNewline();
process.stdout.write(
` ${output.colors.gray(
` ${output.dim(
'Hint: you can run the command with'
)} --verbose ${output.colors.gray(
)} --verbose ${output.dim(
'to see the full dependent project outputs'
)}` + EOL
);
Expand Down Expand Up @@ -299,7 +302,7 @@ export async function createRunOneDynamicOutputRenderer({
];
if (totalCachedTasks > 0) {
pinnedFooterLines.push(
output.colors.gray(
output.dim(
`${EOL} Nx read the output from the cache instead of running the command for ${totalCachedTasks} out of ${totalTasks} tasks.`
)
);
Expand Down Expand Up @@ -342,9 +345,9 @@ export async function createRunOneDynamicOutputRenderer({
` ${output.colors.red(
figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
` ${output.colors.gray(
` ${output.dim(
figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.colors.gray(
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]`
)}`,
],
Expand Down