Skip to content

Commit

Permalink
refactor: collection-factory create method
Browse files Browse the repository at this point in the history
  • Loading branch information
recepkefelii committed Jan 29, 2023
1 parent b928e38 commit 7d5cc58
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/schematics/collection.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@ import { NestCollection } from './nest.collection';

export class CollectionFactory {
public static create(collection: Collection | string): AbstractCollection {
switch (collection) {
case Collection.NESTJS:
return new NestCollection(
RunnerFactory.create(Runner.SCHEMATIC) as SchematicRunner,
);
const schematicRunner = RunnerFactory.create(Runner.SCHEMATIC) as SchematicRunner;

default:
return new CustomCollection(
collection,
RunnerFactory.create(Runner.SCHEMATIC) as SchematicRunner,
);
if (collection === Collection.NESTJS) {
return new NestCollection(schematicRunner);
} else {
return new CustomCollection(collection, schematicRunner);
}
}
}

0 comments on commit 7d5cc58

Please sign in to comment.