Skip to content

Commit

Permalink
feat(schematics): create facade skeleton when creating an extension
Browse files Browse the repository at this point in the history
Closes #109
  • Loading branch information
dhhyi committed Feb 28, 2020
1 parent 22fa47a commit c02d4d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion schematics/src/extension/factory_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Extension Schematic', () => {
.toPromise();
});

it('should create a page in root by default', async () => {
it('should create an extension', async () => {
const options = { ...defaultOptions };

const tree = await schematicRunner.runSchematicAsync('extension', options, appTree).toPromise();
Expand All @@ -37,6 +37,7 @@ describe('Extension Schematic', () => {
Array [
"/projects/bar/src/app/extensions/foo/foo.module.ts",
"/projects/bar/src/app/extensions/foo/exports/foo-exports.module.ts",
"/projects/bar/src/app/extensions/foo/facades/foo.facade.ts",
"/projects/bar/src/app/extensions/foo/pages/foo-routing.module.ts",
"/projects/bar/src/app/extensions/foo/store/foo-store.ts",
"/projects/bar/src/app/extensions/foo/store/foo-store.module.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Injectable } from '@angular/core';
import { Store, select } from '@ngrx/store';

import { get<%= classify(name) %>State } from '../store/<%= dasherize(name) %>-store';

// tslint:disable:member-ordering
@Injectable({ providedIn: 'root' })
export class <%= classify(name) %>Facade {
constructor(private store: Store<{}>) {}

// example for debugging
<%= camelize(name) %>State$ = this.store.pipe(select(get<%= classify(name) %>State));
}

0 comments on commit c02d4d2

Please sign in to comment.