diff --git a/packages/nx/src/command-line/generate.ts b/packages/nx/src/command-line/generate.ts index ea9088b5d679fe..73eeff53739437 100644 --- a/packages/nx/src/command-line/generate.ts +++ b/packages/nx/src/command-line/generate.ts @@ -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}` ); diff --git a/packages/nx/src/utils/print-help.ts b/packages/nx/src/utils/print-help.ts index 27100904bb0227..47c9795ecc312b 100644 --- a/packages/nx/src/utils/print-help.ts +++ b/packages/nx/src/utils/print-help.ts @@ -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, @@ -97,6 +98,11 @@ function generateGeneratorOverviewOutput({ // The `:` char 1; + let installedVersion: string; + try { + installedVersion = readModulePackageJson(pluginName).packageJson.version; + } catch {} + ui.div( ...[ { @@ -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], }, ]