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
  • Loading branch information
Roozenboom committed Nov 7, 2022
1 parent 86b4a51 commit 8abc405
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 @@ -784,33 +784,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

1 comment on commit 8abc405

@vercel
Copy link

@vercel vercel bot commented on 8abc405 Nov 7, 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-dev-nrwl.vercel.app
nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app

Please sign in to comment.