-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schematics): remove creators option
BREAKING CHANGE: BEFORE: Creating actions, reducers, and effects is possible without using the creators syntax is possible. AFTER: All schematics use the non-creators syntax to scaffold the code. The option `--creators` (and `-c`) is removed from the schematic options.
- Loading branch information
1 parent
5b54ac4
commit b60595d
Showing
48 changed files
with
403 additions
and
862 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
7 changes: 0 additions & 7 deletions
7
...tion/creator-files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...rc/action/creator-files/__name@dasherize@if-flat__/__name@dasherize__.actions.ts.template
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...s/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.spec.ts.template
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import * as <%= classify(name) %>Actions from './<%= dasherize(name) %>.actions'; | ||
import * as from<%= classify(name) %> from './<%= dasherize(name) %>.actions'; | ||
|
||
describe('<%= classify(name) %>', () => { | ||
it('should create an instance', () => { | ||
expect(new <%= classify(name)%>Actions.<%= prefix %><%= classify(name) %>s()).toBeTruthy(); | ||
describe('<%= prefix %><%= classify(name) %>s', () => { | ||
it('should return an action', () => { | ||
expect(from<%= classify(name) %>.<%= prefix %><%= classify(name) %>s().type).toBe('[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s'); | ||
}); | ||
}); |
33 changes: 12 additions & 21 deletions
33
...matics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.ts.template
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
import { Action } from '@ngrx/store'; | ||
import { createAction, props } from '@ngrx/store'; | ||
|
||
export enum <%= classify(name) %>ActionTypes { | ||
<%= prefix %><%= classify(name) %>s = '[<%= classify(name) %>] <%= prefix %> <%= classify(name) %>s', | ||
<% if (api) { %><%= prefix %><%= classify(name) %>sSuccess = '[<%= classify(name) %>] <%= prefix %> <%= classify(name) %>s Success',<% } %> | ||
<% if (api) { %><%= prefix %><%= classify(name) %>sFailure = '[<%= classify(name) %>] <%= prefix %> <%= classify(name) %>s Failure',<% } %> | ||
} | ||
export const <%= prefix %><%= classify(name) %>s = createAction( | ||
'[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s' | ||
); | ||
|
||
export class <%= prefix %><%= classify(name) %>s implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.<%= prefix %><%= classify(name) %>s; | ||
} | ||
<% if (api) { %> | ||
export class <%= prefix %><%= classify(name) %>sSuccess implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.<%= prefix %><%= classify(name) %>sSuccess; | ||
constructor(public payload: { data: any }) { } | ||
} | ||
<% if (api) { %>export const <%= prefix %><%= classify(name) %>sSuccess = createAction( | ||
'[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s Success', | ||
props<{ data: any }>() | ||
);<% } %> | ||
|
||
export class <%= prefix %><%= classify(name) %>sFailure implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.<%= prefix %><%= classify(name) %>sFailure; | ||
constructor(public payload: { error: any }) { } | ||
} | ||
<% } %> | ||
<% if (api) { %>export type <%= classify(name) %>Actions = <%= prefix %><%= classify(name) %>s | <%= prefix %><%= classify(name) %>sSuccess | <%= prefix %><%= classify(name) %>sFailure;<% } %> | ||
<% if (!api) { %>export type <%= classify(name) %>Actions = <%= prefix %><%= classify(name) %>s;<% } %> | ||
<% if (api) { %>export const <%= prefix %><%= classify(name) %>sFailure = createAction( | ||
'[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s Failure', | ||
props<{ error: any }>() | ||
);<% } %> |
This file contains 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
Oops, something went wrong.