Last active
December 12, 2019 22:00
-
-
Save AvocadoVenom/557c7dd4d3e95d20f0227f576613b90c to your computer and use it in GitHub Desktop.
Angular schematics : creating main module from template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NgModule } from '@angular/core'; | |
| import { CommonModule } from '@angular/common'; | |
| import { ComponentsModule } from './components/components.module'; | |
| @NgModule({ | |
| declarations: [], | |
| imports: [CommonModule, ComponentsModule] | |
| }) | |
| export class <%= classify(name) %>Module { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createMainModuleFileDefinition(options: ModuleOptions): Rule { | |
| const templateSource = apply(url('./files'), [ | |
| filter(path => path.endsWith('__name@dasherize__.module.ts.template')), | |
| applyTemplates({ | |
| ...strings, | |
| ...options | |
| }), | |
| renameTemplateFiles(), | |
| move(normalize(`${options.name}/`)) | |
| ]); | |
| return mergeWith(templateSource); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment