-
-
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): add the ability to create actions with the prefix (#…
- Loading branch information
1 parent
3b565b4
commit 15bc0df
Showing
9 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...tion/creator-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 from<%= classify(name) %> from './<%= dasherize(name) %>.actions'; | ||
|
||
describe('load<%= classify(name) %>s', () => { | ||
describe('<%= prefix %><%= classify(name) %>s', () => { | ||
it('should return an action', () => { | ||
expect(from<%= classify(name) %>.load<%= classify(name) %>s().type).toBe('[<%= classify(name) %>] Load <%= classify(name) %>s'); | ||
expect(from<%= classify(name) %>.<%= prefix %><%= classify(name) %>s().type).toBe('[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s'); | ||
}); | ||
}); |
12 changes: 6 additions & 6 deletions
12
...rc/action/creator-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,15 +1,15 @@ | ||
import { createAction, props } from '@ngrx/store'; | ||
|
||
export const load<%= classify(name) %>s = createAction( | ||
'[<%= classify(name) %>] Load <%= classify(name) %>s' | ||
export const <%= prefix %><%= classify(name) %>s = createAction( | ||
'[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s' | ||
); | ||
|
||
<% if (api) { %>export const load<%= classify(name) %>sSuccess = createAction( | ||
'[<%= classify(name) %>] Load <%= classify(name) %>s Success', | ||
<% if (api) { %>export const <%= prefix %><%= classify(name) %>sSuccess = createAction( | ||
'[<%= classify(name) %>] <%= classify(prefix) %> <%= classify(name) %>s Success', | ||
props<{ data: any }>() | ||
);<% } %> | ||
|
||
<% if (api) { %>export const load<%= classify(name) %>sFailure = createAction( | ||
'[<%= classify(name) %>] Load <%= classify(name) %>s Failure', | ||
<% 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
22 changes: 11 additions & 11 deletions
22
...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,24 @@ | ||
import { Action } from '@ngrx/store'; | ||
|
||
export enum <%= classify(name) %>ActionTypes { | ||
Load<%= classify(name) %>s = '[<%= classify(name) %>] Load <%= classify(name) %>s', | ||
<% if (api) { %>Load<%= classify(name) %>sSuccess = '[<%= classify(name) %>] Load <%= classify(name) %>s Success',<% } %> | ||
<% if (api) { %>Load<%= classify(name) %>sFailure = '[<%= classify(name) %>] Load <%= classify(name) %>s Failure',<% } %> | ||
<%= 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 class Load<%= classify(name) %>s implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.Load<%= classify(name) %>s; | ||
export class <%= prefix %><%= classify(name) %>s implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.<%= prefix %><%= classify(name) %>s; | ||
} | ||
<% if (api) { %> | ||
export class Load<%= classify(name) %>sSuccess implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.Load<%= classify(name) %>sSuccess; | ||
export class <%= prefix %><%= classify(name) %>sSuccess implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.<%= prefix %><%= classify(name) %>sSuccess; | ||
constructor(public payload: { data: any }) { } | ||
} | ||
|
||
export class Load<%= classify(name) %>sFailure implements Action { | ||
readonly type = <%= classify(name) %>ActionTypes.Load<%= classify(name) %>sFailure; | ||
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 = Load<%= classify(name) %>s | Load<%= classify(name) %>sSuccess | Load<%= classify(name) %>sFailure;<% } %> | ||
<% if (!api) { %>export type <%= classify(name) %>Actions = Load<%= classify(name) %>s;<% } %> | ||
<% 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;<% } %> |
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