Skip to content

Commit

Permalink
fix(core): hide duplicate log entry when displaying generator help (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Apr 19, 2023
1 parent 9fa6d41 commit b3ca503
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export async function generate(cwd: string, args: { [k: string]: any }) {
].join('/n')
);
}
if (!opts.quiet) {
if (!opts.quiet && !opts.help) {
logger.info(
`NX Generating ${opts.collectionName}:${normalizedGeneratorName}`
);
Expand Down
10 changes: 7 additions & 3 deletions packages/nx/src/utils/print-help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { logger } from './logger';
import { output } from './output';
import { Schema } from './params';
import { nxVersion } from './versions';
import { readModulePackageJson } from './package-json';

export function printHelp(
header: string,
Expand Down Expand Up @@ -97,6 +98,11 @@ function generateGeneratorOverviewOutput({
// The `:` char
1;

let installedVersion: string;
try {
installedVersion = readModulePackageJson(pluginName).packageJson.version;
} catch {}

ui.div(
...[
{
Expand All @@ -107,9 +113,7 @@ function generateGeneratorOverviewOutput({
{
text:
pluginName +
(pluginName.startsWith('@nx/') || pluginName.startsWith('@nrwl/')
? chalk.dim(` (v${nxVersion})`)
: ''),
(installedVersion ? chalk.dim(` (v${installedVersion})`) : ''),
padding: [1, 0, 0, 2],
},
]
Expand Down

0 comments on commit b3ca503

Please sign in to comment.