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:
Alan Agius 2023-09-01 10:05:59 +00:00 committed by Alan Agius
parent 17ffedc3ec
commit f600bbc97d
2 changed files with 5 additions and 29 deletions

View File

@ -24,12 +24,8 @@ export class SchematicTestRunner {
registerCollection(collectionName: string, collectionPath: string): void;
// (undocumented)
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)
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)
get tasks(): TaskConfiguration[];
}

View File

@ -7,7 +7,7 @@
*/
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 {
Collection,
DelegateTree,
@ -48,7 +48,10 @@ export class SchematicTestRunner {
private _collection: Collection<{}, {}>;
private _logger: logging.Logger;
constructor(private _collectionName: string, collectionPath: string) {
constructor(
private _collectionName: string,
collectionPath: string,
) {
this._engineHost.registerCollection(_collectionName, collectionPath);
this._logger = new logging.Logger('test');
@ -91,17 +94,6 @@ export class SchematicTestRunner {
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>(
collectionName: string,
schematicName: string,
@ -118,18 +110,6 @@ export class SchematicTestRunner {
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> {
const context = this._engine.createContext({} as Schematic<{}, {}>, parentContext);