Skip to content

Commit

Permalink
fix(core): align yargs options in workspace-generator with generic op…
Browse files Browse the repository at this point in the history
…ts passed to other commands (#9953)
  • Loading branch information
AgentEnder committed Apr 26, 2022
1 parent ff4f924 commit 0ce7ce6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/nx/src/command-line/nx-commands.ts
Expand Up @@ -15,6 +15,12 @@ const daemonHelpOutput = generateDaemonHelpOutput(isGenerateDocsProcess);
// Ensure that the output takes up the available width of the terminal
yargs.wrap(yargs.terminalWidth());

export const parserConfiguration: Partial<yargs.ParserConfigurationOptions> = {
'strip-dashed': true,
// allow parsing --env.SOME_ARG for cypress cli env args
'dot-notation': true,
};

/**
* Exposing the Yargs commands object so the documentation generator can
* parse it. The CLI will consume it and call the `.argv` to bootstrapped
Expand All @@ -23,11 +29,7 @@ yargs.wrap(yargs.terminalWidth());
* le executed correctly.
*/
export const commandsObject = yargs
.parserConfiguration({
'strip-dashed': true,
// allow parsing --env.SOME_ARG for cypress cli env args
'dot-notation': true,
})
.parserConfiguration(parserConfiguration)
.usage(
`
${chalk.bold('Smart, Fast and Extensible Build System')}` +
Expand Down
2 changes: 2 additions & 0 deletions packages/nx/src/command-line/workspace-generators.ts
Expand Up @@ -13,6 +13,7 @@ import { readJsonFile, writeJsonFile } from '../utils/fileutils';
import { logger } from '../utils/logger';
import { getPackageManagerCommand } from '../utils/package-manager';
import { normalizePath } from '../utils/path';
import { parserConfiguration } from './nx-commands';

const rootDirectory = workspaceRoot;
const toolsDir = path.join(rootDirectory, 'tools');
Expand Down Expand Up @@ -160,6 +161,7 @@ function parseOptions(
default: {
interactive: true,
},
configuration: parserConfiguration,
});
parsed['generator'] = `${collectionFile}:${parsed['_'][0]}`;
parsed['_'] = parsed['_'].slice(1);
Expand Down

1 comment on commit 0ce7ce6

@vercel
Copy link

@vercel vercel bot commented on 0ce7ce6 Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.