fix(core): forward args provided to the nx add command to the invoked init generator (#22855)
This commit is contained in:
parent
7f0dc268a0
commit
125c1d2786
@ -119,6 +119,10 @@ async function initializePlugin(
|
|||||||
await runNxAsync(
|
await runNxAsync(
|
||||||
`g ${pkgName}:${initGenerator} --keepExistingVersions${
|
`g ${pkgName}:${initGenerator} --keepExistingVersions${
|
||||||
updatePackageScripts ? ' --updatePackageScripts' : ''
|
updatePackageScripts ? ' --updatePackageScripts' : ''
|
||||||
|
}${
|
||||||
|
options.__overrides_unparsed__.length
|
||||||
|
? ' ' + options.__overrides_unparsed__.join(' ')
|
||||||
|
: ''
|
||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
silent: !options.verbose,
|
silent: !options.verbose,
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { CommandModule } from 'yargs';
|
import { CommandModule } from 'yargs';
|
||||||
|
import { withOverrides } from '../yargs-utils/shared-options';
|
||||||
|
|
||||||
export interface AddOptions {
|
export interface AddOptions {
|
||||||
packageSpecifier: string;
|
packageSpecifier: string;
|
||||||
updatePackageScripts?: boolean;
|
updatePackageScripts?: boolean;
|
||||||
verbose?: boolean;
|
verbose?: boolean;
|
||||||
|
__overrides_unparsed__: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const yargsAddCommand: CommandModule<
|
export const yargsAddCommand: CommandModule<
|
||||||
@ -14,6 +16,10 @@ export const yargsAddCommand: CommandModule<
|
|||||||
describe: 'Install a plugin and initialize it.',
|
describe: 'Install a plugin and initialize it.',
|
||||||
builder: (yargs) =>
|
builder: (yargs) =>
|
||||||
yargs
|
yargs
|
||||||
|
.parserConfiguration({
|
||||||
|
'strip-dashed': true,
|
||||||
|
'unknown-options-as-args': true,
|
||||||
|
})
|
||||||
.positional('packageSpecifier', {
|
.positional('packageSpecifier', {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
description:
|
description:
|
||||||
@ -41,5 +47,6 @@ export const yargsAddCommand: CommandModule<
|
|||||||
'$0 add @nx/react@17.0.0',
|
'$0 add @nx/react@17.0.0',
|
||||||
'Install version `17.0.0` of the `@nx/react` package and run its `@nx/react:init` generator'
|
'Install version `17.0.0` of the `@nx/react` package and run its `@nx/react:init` generator'
|
||||||
) as any,
|
) as any,
|
||||||
handler: (args) => import('./add').then((m) => m.addHandler(args)),
|
handler: (args) =>
|
||||||
|
import('./add').then((m) => m.addHandler(withOverrides(args))),
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user