mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 11:03:53 +08:00
refactor(@angular-devkit/schematics): remove deprecated runExternalSchematicAsync
and runSchematicAsync
BREAKING CHANGE: deprecated `runExternalSchematicAsync` and `runSchematicAsync` methods have been removed in favor of `runExternalSchematic` and `runSchematic`.
This commit is contained in:
parent
17ffedc3ec
commit
f600bbc97d
@ -24,12 +24,8 @@ export class SchematicTestRunner {
|
|||||||
registerCollection(collectionName: string, collectionPath: string): void;
|
registerCollection(collectionName: string, collectionPath: string): void;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
runExternalSchematic<SchematicSchemaT extends object>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Promise<UnitTestTree>;
|
runExternalSchematic<SchematicSchemaT extends object>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Promise<UnitTestTree>;
|
||||||
// @deprecated (undocumented)
|
|
||||||
runExternalSchematicAsync<SchematicSchemaT extends object>(collectionName: string, schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Observable<UnitTestTree>;
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
runSchematic<SchematicSchemaT extends object>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Promise<UnitTestTree>;
|
runSchematic<SchematicSchemaT extends object>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Promise<UnitTestTree>;
|
||||||
// @deprecated (undocumented)
|
|
||||||
runSchematicAsync<SchematicSchemaT extends object>(schematicName: string, opts?: SchematicSchemaT, tree?: Tree_2): Observable<UnitTestTree>;
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
get tasks(): TaskConfiguration[];
|
get tasks(): TaskConfiguration[];
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { logging, schema } from '@angular-devkit/core';
|
import { logging, schema } from '@angular-devkit/core';
|
||||||
import { Observable, from, lastValueFrom, of as observableOf } from 'rxjs';
|
import { Observable, lastValueFrom, of as observableOf } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
Collection,
|
Collection,
|
||||||
DelegateTree,
|
DelegateTree,
|
||||||
@ -48,7 +48,10 @@ export class SchematicTestRunner {
|
|||||||
private _collection: Collection<{}, {}>;
|
private _collection: Collection<{}, {}>;
|
||||||
private _logger: logging.Logger;
|
private _logger: logging.Logger;
|
||||||
|
|
||||||
constructor(private _collectionName: string, collectionPath: string) {
|
constructor(
|
||||||
|
private _collectionName: string,
|
||||||
|
collectionPath: string,
|
||||||
|
) {
|
||||||
this._engineHost.registerCollection(_collectionName, collectionPath);
|
this._engineHost.registerCollection(_collectionName, collectionPath);
|
||||||
this._logger = new logging.Logger('test');
|
this._logger = new logging.Logger('test');
|
||||||
|
|
||||||
@ -91,17 +94,6 @@ export class SchematicTestRunner {
|
|||||||
return new UnitTestTree(newTree);
|
return new UnitTestTree(newTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated since version 15.1. Use `runSchematic` instead.
|
|
||||||
*/
|
|
||||||
runSchematicAsync<SchematicSchemaT extends object>(
|
|
||||||
schematicName: string,
|
|
||||||
opts?: SchematicSchemaT,
|
|
||||||
tree?: Tree,
|
|
||||||
): Observable<UnitTestTree> {
|
|
||||||
return from(this.runSchematic(schematicName, opts, tree));
|
|
||||||
}
|
|
||||||
|
|
||||||
async runExternalSchematic<SchematicSchemaT extends object>(
|
async runExternalSchematic<SchematicSchemaT extends object>(
|
||||||
collectionName: string,
|
collectionName: string,
|
||||||
schematicName: string,
|
schematicName: string,
|
||||||
@ -118,18 +110,6 @@ export class SchematicTestRunner {
|
|||||||
return new UnitTestTree(newTree);
|
return new UnitTestTree(newTree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated since version 15.1. Use `runExternalSchematic` instead.
|
|
||||||
*/
|
|
||||||
runExternalSchematicAsync<SchematicSchemaT extends object>(
|
|
||||||
collectionName: string,
|
|
||||||
schematicName: string,
|
|
||||||
opts?: SchematicSchemaT,
|
|
||||||
tree?: Tree,
|
|
||||||
): Observable<UnitTestTree> {
|
|
||||||
return from(this.runExternalSchematic(collectionName, schematicName, opts, tree));
|
|
||||||
}
|
|
||||||
|
|
||||||
callRule(rule: Rule, tree: Tree, parentContext?: Partial<SchematicContext>): Observable<Tree> {
|
callRule(rule: Rule, tree: Tree, parentContext?: Partial<SchematicContext>): Observable<Tree> {
|
||||||
const context = this._engine.createContext({} as Schematic<{}, {}>, parentContext);
|
const context = this._engine.createContext({} as Schematic<{}, {}>, parentContext);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user