Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): align yargs options in workspace-generator with generic options passed into other commands #9953

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/nx/src/command-line/nx-commands.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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