Skip to content
This repository was archived by the owner on Nov 27, 2019. It is now read-only.

Commit

Permalink
chore(Example): Renamed files to be consistent with Angular CLI (ngrx…
Browse files Browse the repository at this point in the history
  • Loading branch information
martzmakes authored and brandonroberts committed Apr 27, 2018
1 parent 1046043 commit 7e50187
Show file tree
Hide file tree
Showing 68 changed files with 112 additions and 105 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ output
*.ngsummary.json
*.ngfactory.ts
tmp

example-dist/
2 changes: 1 addition & 1 deletion docs/effects/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ If you want to trigger another action, be careful to add this effect at the end.
import { Injectable } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { defer } from 'rxjs';
import { LoginAction, LogoutAction } from './auth';
import { LoginAction, LogoutAction } from './auth.actions';

@Injectable()
export class SomeEffectsClass {
Expand Down
11 changes: 4 additions & 7 deletions docs/store/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Provide the `ActionReducerMap<T>` with your reducer map for added type checking.

```ts
import { ActionReducerMap } from '@ngrx/store';
import * as fromAuth from './auth';
import * as fromAuth from './auth.actions';

export interface State {
auth: fromAuth.State;
Expand Down Expand Up @@ -45,10 +45,7 @@ export class Reset implements Action {
constructor(public payload: number) {}
}

export type CounterActionsUnion =
| Increment
| Decrement
| Reset;
export type CounterActionsUnion = Increment | Decrement | Reset;
```

This provides typed actions for your reducer functions.
Expand All @@ -58,7 +55,7 @@ This provides typed actions for your reducer functions.
import { CounterActionTypes, CounterActionsUnion } from './counter.actions';

export function reducer(state: number = 0, action: CounterActionsUnion): State {
switch(action.type) {
switch (action.type) {
case CounterActionTypes.INCREMENT: {
return state + 1;
}
Expand Down Expand Up @@ -95,7 +92,7 @@ interface AppState {
<button (click)="increment()">Increment</button>
<button (click)="decrement()">Decrement</button>
<button (click)="reset()">Reset Counter</button>
<div>Current Count: {{ counter | async }}</div>
`,
})
Expand Down
2 changes: 1 addition & 1 deletion example-app/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { reducers, metaReducers } from './reducers';
import { schema } from './db';
import { CustomRouterStateSerializer } from './shared/utils';

import { AppComponent } from './core/containers/app';
import { AppComponent } from './core/containers/app.component';
import { environment } from '../environments/environment';

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { StoreModule, Store, combineReducers } from '@ngrx/store';
import { LoginPageComponent } from './login-page.component';
import { LoginFormComponent } from '../components/login-form.component';
import * as AuthActions from '../actions/auth';
import * as AuthActions from '../actions/auth.actions';
import * as fromAuth from '../reducers';

describe('Login Page', () => {
Expand Down
2 changes: 1 addition & 1 deletion example-app/app/auth/containers/login-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Authenticate } from '../models/user';
import * as fromAuth from '../reducers';
import * as AuthActions from '../actions/auth';
import * as AuthActions from '../actions/auth.actions';

@Component({
selector: 'bc-login-page',
Expand Down
2 changes: 1 addition & 1 deletion example-app/app/auth/effects/auth.effects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
LoginRedirect,
LoginSuccess,
Logout,
} from '../actions/auth';
} from '../actions/auth.actions';
import { Authenticate, User } from '../models/user';
import { AuthService } from '../services/auth.service';
import { AuthEffects } from './auth.effects';
Expand Down
2 changes: 1 addition & 1 deletion example-app/app/auth/effects/auth.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Login,
LoginFailure,
LoginSuccess,
} from '../actions/auth';
} from '../actions/auth.actions';
import { Authenticate } from '../models/user';
import { AuthService } from '../services/auth.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reducer } from './auth';
import * as fromAuth from './auth';
import { Login, LoginSuccess, Logout } from '../actions/auth';
import { reducer } from './auth.reducer';
import * as fromAuth from './auth.reducer';
import { Login, LoginSuccess, Logout } from '../actions/auth.actions';
import { Authenticate, User } from '../models/user';

describe('AuthReducer', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthActionsUnion, AuthActionTypes } from './../actions/auth';
import { AuthActionsUnion, AuthActionTypes } from './../actions/auth.actions';
import { User } from '../models/user';

export interface State {
Expand Down
4 changes: 2 additions & 2 deletions example-app/app/auth/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
ActionReducerMap,
} from '@ngrx/store';
import * as fromRoot from '../../reducers';
import * as fromAuth from './auth';
import * as fromLoginPage from './login-page';
import * as fromAuth from './auth.reducer';
import * as fromLoginPage from './login-page.reducer';

export interface AuthState {
status: fromAuth.State;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { reducer } from './login-page';
import * as fromLoginPage from './login-page';
import { Login, LoginSuccess, LoginFailure, Logout } from '../actions/auth';
import { reducer } from './login-page.reducer';
import * as fromLoginPage from './login-page.reducer';
import {
Login,
LoginSuccess,
LoginFailure,
Logout,
} from '../actions/auth.actions';
import { Authenticate, User } from '../models/user';

describe('LoginPageReducer', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthActionTypes, AuthActionsUnion } from './../actions/auth';
import { AuthActionTypes, AuthActionsUnion } from './../actions/auth.actions';

export interface State {
error: string | null;
Expand Down
2 changes: 1 addition & 1 deletion example-app/app/auth/services/auth-guard.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TestBed, inject } from '@angular/core/testing';
import { StoreModule, Store, combineReducers } from '@ngrx/store';
import { cold } from 'jasmine-marbles';
import { AuthGuard } from './auth-guard.service';
import * as AuthActions from '../actions/auth';
import * as AuthActions from '../actions/auth.actions';
import * as fromRoot from '../../reducers';
import * as fromAuth from '../reducers';

Expand Down
2 changes: 1 addition & 1 deletion example-app/app/auth/services/auth-guard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CanActivate } from '@angular/router';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { map, take } from 'rxjs/operators';
import * as AuthActions from '../actions/auth';
import * as AuthActions from '../actions/auth.actions';
import * as fromAuth from '../reducers';

@Injectable()
Expand Down
14 changes: 7 additions & 7 deletions example-app/app/books/books.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';

import { ComponentsModule } from './components';
import { BookEffects } from './effects/book';
import { CollectionEffects } from './effects/collection';
import { BookExistsGuard } from './guards/book-exists';
import { BookEffects } from './effects/book.effects';
import { CollectionEffects } from './effects/collection.effects';
import { BookExistsGuard } from './guards/book-exists.guard';

import { FindBookPageComponent } from './containers/find-book-page';
import { ViewBookPageComponent } from './containers/view-book-page';
import { SelectedBookPageComponent } from './containers/selected-book-page';
import { CollectionPageComponent } from './containers/collection-page';
import { FindBookPageComponent } from './containers/find-book-page.component';
import { ViewBookPageComponent } from './containers/view-book-page.component';
import { SelectedBookPageComponent } from './containers/selected-book-page.component';
import { CollectionPageComponent } from './containers/collection-page.component';
import { MaterialModule } from '../material';

import { reducers } from './reducers';
Expand Down
10 changes: 5 additions & 5 deletions example-app/app/books/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';

import { BookAuthorsComponent } from './book-authors';
import { BookDetailComponent } from './book-detail';
import { BookPreviewComponent } from './book-preview';
import { BookPreviewListComponent } from './book-preview-list';
import { BookSearchComponent } from './book-search';
import { BookAuthorsComponent } from './book-authors.component';
import { BookDetailComponent } from './book-detail.component';
import { BookPreviewComponent } from './book-preview.component';
import { BookPreviewListComponent } from './book-preview-list.component';
import { BookSearchComponent } from './book-search.component';

import { PipesModule } from '../../shared/pipes';
import { MaterialModule } from '../../material';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { CollectionPageComponent } from './collection-page';
import { CollectionPageComponent } from './collection-page.component';
import { combineReducers, Store, StoreModule } from '@ngrx/store';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { MatCardModule, MatInputModule } from '@angular/material';
import { BookPreviewListComponent } from '../components/book-preview-list';
import { BookPreviewComponent } from '../components/book-preview';
import * as CollectionActions from '../actions/collection';
import { BookPreviewListComponent } from '../components/book-preview-list.component';
import { BookPreviewComponent } from '../components/book-preview.component';
import * as CollectionActions from '../actions/collection.actions';
import * as fromBooks from '../reducers';
import { EllipsisPipe } from '../../shared/pipes/ellipsis';
import { AddCommasPipe } from '../../shared/pipes/add-commas';
import { BookAuthorsComponent } from '../components/book-authors';
import { EllipsisPipe } from '../../shared/pipes/ellipsis.pipe';
import { AddCommasPipe } from '../../shared/pipes/add-commas.pipe';
import { BookAuthorsComponent } from '../components/book-authors.component';

describe('Collection Page', () => {
let fixture: ComponentFixture<CollectionPageComponent>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';

import * as CollectionActions from '../actions/collection';
import * as CollectionActions from '../actions/collection.actions';
import { Book } from '../models/book';
import * as fromBooks from '../reducers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
import { combineReducers, Store, StoreModule } from '@ngrx/store';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

import { BookSearchComponent } from '../components/book-search';
import { BookPreviewComponent } from '../components/book-preview';
import { BookPreviewListComponent } from '../components/book-preview-list';
import { BookSearchComponent } from '../components/book-search.component';
import { BookPreviewComponent } from '../components/book-preview.component';
import { BookPreviewListComponent } from '../components/book-preview-list.component';
import { RouterTestingModule } from '@angular/router/testing';
import { EllipsisPipe } from '../../shared/pipes/ellipsis';
import { BookAuthorsComponent } from '../components/book-authors';
import { AddCommasPipe } from '../../shared/pipes/add-commas';
import { FindBookPageComponent } from './find-book-page';
import * as BookActions from '../actions/book';
import { EllipsisPipe } from '../../shared/pipes/ellipsis.pipe';
import { BookAuthorsComponent } from '../components/book-authors.component';
import { AddCommasPipe } from '../../shared/pipes/add-commas.pipe';
import { FindBookPageComponent } from './find-book-page.component';
import * as BookActions from '../actions/book.actions';
import * as fromBooks from '../reducers';

describe('Find Book Page', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { take } from 'rxjs/operators';

import * as BookActions from '../actions/book';
import * as BookActions from '../actions/book.actions';
import { Book } from '../models/book';
import * as fromBooks from '../reducers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SelectedBookPageComponent } from './selected-book-page';
import { SelectedBookPageComponent } from './selected-book-page.component';
import { combineReducers, Store, StoreModule } from '@ngrx/store';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatCardModule } from '@angular/material';

import * as CollectionActions from '../actions/collection';
import * as CollectionActions from '../actions/collection.actions';
import * as fromBooks from '../reducers';
import { BookDetailComponent } from '../components/book-detail';
import { BookDetailComponent } from '../components/book-detail.component';
import { Book, generateMockBook } from '../models/book';
import { BookAuthorsComponent } from '../components/book-authors';
import { AddCommasPipe } from '../../shared/pipes/add-commas';
import { BookAuthorsComponent } from '../components/book-authors.component';
import { AddCommasPipe } from '../../shared/pipes/add-commas.pipe';

describe('Selected Book Page', () => {
let fixture: ComponentFixture<SelectedBookPageComponent>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';

import * as fromBooks from '../reducers';
import * as CollectionActions from '../actions/collection';
import * as CollectionActions from '../actions/collection.actions';
import { Book } from '../models/book';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { ActivatedRoute } from '@angular/router';
import { BehaviorSubject } from 'rxjs';
import { MatCardModule } from '@angular/material';

import { ViewBookPageComponent } from './view-book-page';
import * as BookActions from '../actions/book';
import { ViewBookPageComponent } from './view-book-page.component';
import * as BookActions from '../actions/book.actions';
import * as fromBooks from '../reducers';
import { SelectedBookPageComponent } from './selected-book-page';
import { BookDetailComponent } from '../components/book-detail';
import { BookAuthorsComponent } from '../components/book-authors';
import { AddCommasPipe } from '../../shared/pipes/add-commas';
import { SelectedBookPageComponent } from './selected-book-page.component';
import { BookDetailComponent } from '../components/book-detail.component';
import { BookAuthorsComponent } from '../components/book-authors.component';
import { AddCommasPipe } from '../../shared/pipes/add-commas.pipe';

describe('View Book Page', () => {
let params = new BehaviorSubject({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Subscription } from 'rxjs';
import { map } from 'rxjs/operators';

import * as fromBooks from '../reducers';
import * as BookActions from '../actions/book';
import * as BookActions from '../actions/book.actions';

/**
* Note: Container components are also reusable. Whether or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Actions } from '@ngrx/effects';
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
import { empty, Observable } from 'rxjs';

import { GoogleBooksService } from '../../core/services/google-books';
import { Search, SearchComplete, SearchError } from '../actions/book';
import { GoogleBooksService } from '../../core/services/google-books.service';
import { Search, SearchComplete, SearchError } from '../actions/book.actions';
import { Book } from '../models/book';
import { BookEffects, SEARCH_DEBOUNCE, SEARCH_SCHEDULER } from './book';
import { BookEffects, SEARCH_DEBOUNCE, SEARCH_SCHEDULER } from './book.effects';

export class TestActions extends Actions {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import {
takeUntil,
} from 'rxjs/operators';

import { GoogleBooksService } from '../../core/services/google-books';
import { GoogleBooksService } from '../../core/services/google-books.service';
import {
BookActionTypes,
Search,
SearchComplete,
SearchError,
} from '../actions/book';
} from '../actions/book.actions';
import { Book } from '../models/book';
import { Scheduler } from 'rxjs/internal/Scheduler';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Actions } from '@ngrx/effects';
import { cold, hot } from 'jasmine-marbles';
import { empty, Observable } from 'rxjs';

import * as CollectionActions from '../actions/collection';
import * as CollectionActions from '../actions/collection.actions';
import { Book } from '../models/book';
import { CollectionEffects } from './collection';
import { CollectionEffects } from './collection.effects';

export class TestActions extends Actions {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
RemoveBook,
RemoveBookFail,
RemoveBookSuccess,
} from './../actions/collection';
} from './../actions/collection.actions';

@Injectable()
export class CollectionEffects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { select, Store } from '@ngrx/store';
import { Observable, of } from 'rxjs';
import { catchError, filter, map, switchMap, take, tap } from 'rxjs/operators';

import { GoogleBooksService } from '../../core/services/google-books';
import * as BookActions from '../actions/book';
import { GoogleBooksService } from '../../core/services/google-books.service';
import * as BookActions from '../actions/book.actions';
import * as fromBooks from '../reducers';

/**
Expand Down
Loading

0 comments on commit 7e50187

Please sign in to comment.