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
| export function scaffoldSchematics(options: any): Rule { | |
| return (tree: Tree, _context: SchematicContext) => { | |
| return tree.create('path/to/folder/.gitkeep'), ''); | |
| }; | |
| } |
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
| { | |
| "$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json", | |
| "schematics": { | |
| "scaffold-schematics": { | |
| "description": "A schematic to scaffold your project.", | |
| "factory": "./scaffold-schematics/index#scaffoldSchematics", | |
| "schema": "./scaffold-schematics/schema.json" | |
| } | |
| } | |
| } |
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 createDataRelatedFolders(options: ModuleOptions): Rule { | |
| return (tree: Tree, _: SchematicContext) => { | |
| tree.create(normalize(`${options.name}/data/models/.gitkeep`), ''); | |
| tree.create(normalize(`${options.name}/data/services/.gitkeep`), ''); | |
| return tree; | |
| }; | |
| } |
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 createStoreFolder(options: ModuleOptions): Rule { | |
| return (tree: Tree, _: SchematicContext) => { | |
| tree.create(normalize(`${options.name}/data/store/.gitkeep`), ''); | |
| return tree; | |
| }; | |
| } |
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 createAtomicDesignPatternFolders(options: ModuleOptions): Rule { | |
| return (tree: Tree, _: SchematicContext) => { | |
| tree.create(normalize(`${options.name}/components/atoms/.gitkeep`), ''); | |
| tree.create(normalize(`${options.name}/components/molecules/.gitkeep`), ''); | |
| tree.create(normalize(`${options.name}/components/organisms/.gitkeep`), ''); | |
| tree.create(normalize(`${options.name}/components/pages/.gitkeep`), ''); | |
| return tree; | |
| }; | |
| } |
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 createComponentsModuleFileDefinition(options: ModuleOptions): Rule { | |
| const templateSource = apply(url('./files'), [ | |
| filter(path => path.endsWith('/components.module.ts.template')), | |
| applyTemplates({ | |
| ...strings, | |
| ...options | |
| }), | |
| renameTemplateFiles(), | |
| move(normalize(`${options.name}/components`)) | |
| ]); |
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
| export function scaffoldSchematics(options: ModuleOptions): Rule { | |
| return chain([ | |
| executeComponentsTasks(options), | |
| createDataRelatedFolders(options), | |
| options.useStore ? createStoreFolder(options) : noop(), | |
| createMainModuleFileDefinition(options) | |
| ]); | |
| } |
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 { Action } from '@ngrx/store'; | |
| export const LOAD_DATA = '[Data] LOAD_DATA'; | |
| export const SET_DATA = '[Data] SET_DATA'; | |
| export class LoadData implements Action { | |
| readonly type = LOAD_DATA; | |
| } | |
| export class SetData implements Action { |
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 { Injectable } from '@angular/core'; | |
| import { Store } from '@ngrx/store'; | |
| import { Effect, ofType, Actions } from '@ngrx/effects'; | |
| import { switchMap, map, catchError } from 'rxjs/operators'; | |
| import { of } from 'rxjs'; | |
| import * as fromApp from '@store/app.reducer'; | |
| import * as Actions from '@store/data/data.actions'; | |
| import { DataService } from '@app/data/services/data/data.service'; |