Skip to content

Commit

Permalink
Remove brackets for list of capabilities of a plugin when using `nx l…
Browse files Browse the repository at this point in the history
…ist` if it has none (#27286)

<!-- 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` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
When running `nx list`, if a plugin has no capabilities (i.e.
`@nx/eslint-plugin`), it will show brackets with an empty list of
capabilities.

```shell
$ nx list                                                                                                                                                                                                  
                                                                                                                                                                                                                                            
 NX   Installed plugins:                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                         
@nx/eslint (executors,generators)                                                                                                                                                                                                                        
@nx/eslint-plugin ()                                                                                                                                                                                                                                     
@nx/js (executors,generators)                                                                                                                                                                                                                            
@nx/workspace (executors,generators)                                                                                                                                                                                                                     
nx (executors,generators)                                                                                                                                                                                                                          
```

https://asciinema.org/a/XxJjVyoIoQgjj8fsM6fb0TXQT

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
When running `nx list`, if a plugin has no capabilities (i.e.
`@nx/eslint-plugin`), it won't show brackets with an empty list of
capabilities.

```shell
$ nx list
nx list                                                                                                                                
                                                                                                                                                                                                      
 NX   Installed plugins:                                                                                                                                                                              
                                                                                                                                                                                                      
@nx/eslint (executors,generators)                                                                                                                                                                     
@nx/eslint-plugin                                                                                                                                                                                     
@nx/js (executors,generators)                                                                                                                                                                         
nx (executors,generators)                                                                                                                                                                             
```

https://asciinema.org/a/CHPkcO6hRURZRuBRJxUSRayGx

## Related Issue(s)
N/A
  • Loading branch information
AllySummers authored Aug 10, 2024
1 parent abfb25d commit a13961d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/nx/src/utils/plugins/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export function listPlugins(
if (p.projectInference) {
capabilities.push('project-inference');
}
bodyLines.push(`${chalk.bold(p.name)} (${capabilities.join()})`);
bodyLines.push(
`${chalk.bold(p.name)} ${
capabilities.length >= 1 ? `(${capabilities.join()})` : ''
}`
);
}

output.log({
Expand Down

0 comments on commit a13961d

Please sign in to comment.