Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix: Remove duplicated names (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
EndyKaufman committed May 12, 2019
1 parent 7f45569 commit e1a1243
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/schematics/rucken-entity-nestjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function createProviders(options: NormalizedSchema, typeName: string, asProvider
);
project.addExistingSourceFiles(srcPath);

const allImports = [];
let allImports = [];
let allClasses = [];

project
Expand All @@ -152,6 +152,14 @@ function createProviders(options: NormalizedSchema, typeName: string, asProvider
)} } from './${sourceFile.getBaseName().replace('.ts', '')}';`
);
});

allImports = allImports.filter((elem, index, self) => {
return index === self.indexOf(elem);
});
allClasses = allClasses.filter((elem, index, self) => {
return index === self.indexOf(elem);
});

const newSourceFile = project.createSourceFile(
'index.ts',
(
Expand Down
10 changes: 9 additions & 1 deletion src/schematics/rucken-entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function createProviders(options: NormalizedSchema): Rule {
);
project.addExistingSourceFiles(srcPath);

const allImports = [];
let allImports = [];
let allProviders = [];

project
Expand Down Expand Up @@ -129,6 +129,14 @@ function createProviders(options: NormalizedSchema): Rule {
)} } from './${sourceFile.getBaseName().replace('.ts', '')}';`
);
});

allImports = allImports.filter((elem, index, self) => {
return index === self.indexOf(elem);
});
allProviders = allProviders.filter((elem, index, self) => {
return index === self.indexOf(elem);
});

const newSourceFile = project.createSourceFile(
'providers.ts',
`import { Provider } from '@angular/core';
Expand Down

0 comments on commit e1a1243

Please sign in to comment.