Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
fix(generators): add exception for providers
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartington committed Jul 27, 2017
1 parent b0bcb05 commit db9c793
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/generators/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function hydrateRequest(context: BuildContext, request: GeneratorRequest)
export function createCommonModule(envVar: string, requestType: string) {
let className = requestType.charAt(0).toUpperCase() + requestType.slice(1) + 's';
let tmplt = `import { NgModule } from '@angular/core';\n@NgModule({\n\tdeclarations: [],\n\timports: [],\n\texports: []\n})\nexport class ${className}Module {}\n`;
writeFileSync(envVar, tmplt)
writeFileSync(envVar, tmplt);
}

export function hydrateTabRequest(context: BuildContext, request: GeneratorTabRequest) {
Expand Down Expand Up @@ -194,9 +194,9 @@ export async function nonPageFileManipulation(context: BuildContext, name: strin
let importPath;
let fileContent: string;
let templatesArray: string[] = await generateTemplates(context, hydratedRequest, false);

if (!existsSync(envVar)) createCommonModule(envVar, hydratedRequest.type);

if (hydratedRequest.type === 'pipe' || hydratedRequest.type === 'component' || hydratedRequest.type === 'directive') {
if (!existsSync(envVar)) createCommonModule(envVar, hydratedRequest.type);
}
const typescriptFilePath = changeExtension(templatesArray.filter(path => extname(path) === '.ts')[0], '');


Expand Down

0 comments on commit db9c793

Please sign in to comment.