Skip to content

Commit

Permalink
fix(core): fix custom workspace-generator options (#12821)
Browse files Browse the repository at this point in the history
Closes: #12677
(cherry picked from commit 8abc405)
  • Loading branch information
Roozenboom authored and FrozenPandaz committed Nov 7, 2022
1 parent 23fcf58 commit 8ba21f3
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions packages/nx/src/command-line/nx-commands.ts
Expand Up @@ -777,33 +777,33 @@ async function withCustomGeneratorOptions(
const options = [];
const positionals = [];

Object.entries(schema.properties as WorkspaceGeneratorProperties).forEach(
([name, prop]) => {
const option: { name: string; definition: OptionArgumentDefinition } = {
Object.entries(
(schema.properties ?? {}) as WorkspaceGeneratorProperties
).forEach(([name, prop]) => {
const option: { name: string; definition: OptionArgumentDefinition } = {
name,
definition: {
describe: prop.description,
type: prop.type,
default: prop.default,
choices: prop.enum,
},
};
if (schema.required && schema.required.includes(name)) {
option.definition.demandOption = true;
}
options.push(option);
if (isPositionalProperty(prop)) {
positionals.push({
name,
definition: {
describe: prop.description,
type: prop.type,
default: prop.default,
choices: prop.enum,
},
};
if (schema.required && schema.required.includes(name)) {
option.definition.demandOption = true;
}
options.push(option);
if (isPositionalProperty(prop)) {
positionals.push({
name,
definition: {
describe: prop.description,
type: prop.type,
choices: prop.enum,
},
});
}
});
}
);
});

let command = generatorName;
positionals.forEach(({ name }) => {
Expand Down

0 comments on commit 8ba21f3

Please sign in to comment.