Skip to content

Commit c8ddfbb

Browse files
hanslalexeagle
authored andcommitted
fix(@angular/cli): add options in help for architect commands
And fix a bug with json schema to Option array.
1 parent 7ffd3b3 commit c8ddfbb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/angular/cli/models/architect-command.ts

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ export abstract class ArchitectCommand extends Command<ArchitectCommandOptions>
8787
if ((!targetSpec.project || !targetSpec.target) && !this.multiTarget) {
8888
throw new Error('Cannot determine project or target for Architect command.');
8989
}
90+
91+
const builderConf = this._architect.getBuilderConfiguration(targetSpec);
92+
const builderDesc = await this._architect.getBuilderDescription(builderConf).toPromise();
93+
const targetOptionArray = await parseJsonSchemaToOptions(this._registry, builderDesc.schema);
94+
95+
this.description.options.push(...targetOptionArray);
9096
}
9197

9298
async run(options: ArchitectCommandOptions) {

packages/angular/cli/utilities/json-schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export async function parseJsonSchemaToOptions(
7979
if (!parentSchema) {
8080
// Ignore root.
8181
return;
82-
} else if (pointer.split(/properties|items/g).length > 2) {
82+
} else if (pointer.split(/\/(?:properties|items|definitions)\//g).length > 2) {
8383
// Ignore subitems (objects or arrays).
8484
return;
8585
} else if (json.isJsonArray(current)) {

0 commit comments

Comments
 (0)