feat(core): clean up show project --json false (#23486)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

<img width="657" alt="Screenshot 2024-05-27 at 1 54 08 PM"
src="https://github.com/nrwl/nx/assets/16211801/b66bbf57-1d75-485f-bf8e-17a28579a7e5">

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Emily Xiong 2024-05-27 15:37:04 -04:00 committed by GitHub
parent 6292055aba
commit a7c5603691
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,10 +47,17 @@ export async function showProjectHandler(
if (targets.length > 0) {
console.log(`${chalk.bold('Targets')}: `);
for (const [target, targetConfig] of targets) {
const executorCommandText =
targetConfig.metadata?.scriptContent ??
targetConfig?.options?.command ??
(targetConfig?.options?.commands?.length === 1
? targetConfig.options.commands[0]
: targetConfig?.executor) ??
'';
console.log(
`- ${chalk.bold((target + ':').padEnd(maxTargetNameLength + 2))} ${(
targetConfig?.executor ?? ''
).padEnd(maxExecutorNameLength + 2)} ${(() => {
`- ${chalk.bold(
(target + ':').padEnd(maxTargetNameLength + 2)
)} ${executorCommandText.padEnd(maxExecutorNameLength + 2)} ${(() => {
const configurations = Object.keys(
targetConfig.configurations ?? {}
);