Skip to content

Commit cd8801c

Browse files
qiyiggalexeagle
authored andcommitted
fix(@angular-devkit/schematics): fix issues in google (#11857)
1. update the return type of 'validateOptionsWithSchema' to make it conform the signature of engineHost.registerOptionsTransform 2. fix minor naming issue
1 parent 3000c8a commit cd8801c

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export abstract class SchematicCommand extends Command {
8686
private _originalOptions: Option[];
8787
private _engineHost: FileSystemEngineHostBase;
8888
private _engine: Engine<FileSystemCollectionDesc, FileSystemSchematicDesc>;
89-
private _workFlow: workflow.BaseWorkflow;
89+
private _workflow: workflow.BaseWorkflow;
9090
argStrategy = ArgumentStrategy.Nothing;
9191

9292
constructor(
@@ -166,7 +166,7 @@ export abstract class SchematicCommand extends Command {
166166
/*
167167
* Runtime hook to allow specifying customized workflow
168168
*/
169-
protected getWorkFlow(options: RunSchematicOptions): workflow.BaseWorkflow {
169+
protected getWorkflow(options: RunSchematicOptions): workflow.BaseWorkflow {
170170
const {force, dryRun} = options;
171171
const fsHost = new virtualFs.ScopedHost(
172172
new NodeJsSyncHost(), normalize(this.project.root));
@@ -182,12 +182,12 @@ export abstract class SchematicCommand extends Command {
182182
);
183183
}
184184

185-
private _getWorkFlow(options: RunSchematicOptions): workflow.BaseWorkflow {
186-
if (!this._workFlow) {
187-
this._workFlow = this.getWorkFlow(options);
185+
private _getWorkflow(options: RunSchematicOptions): workflow.BaseWorkflow {
186+
if (!this._workflow) {
187+
this._workflow = this.getWorkflow(options);
188188
}
189189

190-
return this._workFlow;
190+
return this._workflow;
191191
}
192192

193193
protected runSchematic(options: RunSchematicOptions) {
@@ -196,7 +196,7 @@ export abstract class SchematicCommand extends Command {
196196
let nothingDone = true;
197197
let loggingQueue: string[] = [];
198198
let error = false;
199-
const workflow = this._getWorkFlow(options);
199+
const workflow = this._getWorkflow(options);
200200

201201
const workingDir = process.cwd().replace(this.project.root, '').replace(/\\/g, '/');
202202
const pathOptions = this.setPathOptions(schematicOptions, workingDir);

packages/angular_devkit/schematics/tools/schema-option-transform.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
import { deepCopy, schema } from '@angular-devkit/core';
99
import { Observable, of as observableOf } from 'rxjs';
1010
import { first, map, mergeMap } from 'rxjs/operators';
11-
import { SchematicDescription } from '../src';
12-
import { FileSystemCollectionDescription, FileSystemSchematicDescription } from './description';
13-
14-
export type SchematicDesc =
15-
SchematicDescription<FileSystemCollectionDescription, FileSystemSchematicDescription>;
16-
11+
import { FileSystemSchematicDescription } from './description';
1712

1813
export class InvalidInputOptions<T = {}> extends schema.SchemaValidationException {
1914
constructor(options: T, errors: schema.SchemaValidatorError[]) {
@@ -26,7 +21,7 @@ export class InvalidInputOptions<T = {}> extends schema.SchemaValidationExceptio
2621

2722
// This can only be used in NodeJS.
2823
export function validateOptionsWithSchema(registry: schema.SchemaRegistry) {
29-
return <T extends {}>(schematic: SchematicDesc, options: T): Observable<T> => {
24+
return <T extends {}>(schematic: FileSystemSchematicDescription, options: T): Observable<T> => {
3025
// Prevent a schematic from changing the options object by making a copy of it.
3126
options = deepCopy(options);
3227

0 commit comments

Comments
 (0)