-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(schematics): add entity generation as part of feature schematic #3850
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c191c9a
Squashed commit of the following:
e70d23c
reverting yarn.lock
19d3d42
Merge branch 'main' into issue-3260
wgd3 bf386a5
Merge branch 'main' into issue-3260
wgd3 e6d983f
Merge branch 'main' into issue-3260
wgd3 0460889
updated schematic order for feature to match snapshot
87b34e9
removed additional pluralization in actions template
bd16c48
Update modules/schematics/src/feature/index.spec.ts
wgd3 11e2d3b
Merge branch 'main' into issue-3260
wgd3 8702590
updated snapshots for feature schematic
wgd3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,78 @@ | ||
import { | ||
chain, | ||
Rule, | ||
schematic, | ||
SchematicContext, | ||
Tree, | ||
chain, | ||
schematic, | ||
} from '@angular-devkit/schematics'; | ||
|
||
import { Schema as FeatureOptions } from './schema'; | ||
|
||
export default function (options: FeatureOptions): Rule { | ||
return (host: Tree, context: SchematicContext) => { | ||
return chain([ | ||
schematic('action', { | ||
flat: options.flat, | ||
group: options.group, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
schematic('reducer', { | ||
flat: options.flat, | ||
group: options.group, | ||
module: options.module, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
reducers: options.reducers, | ||
feature: true, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
schematic('effect', { | ||
flat: options.flat, | ||
group: options.group, | ||
module: options.module, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
feature: true, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
schematic('selector', { | ||
flat: options.flat, | ||
group: options.group, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
feature: true, | ||
}), | ||
])(host, context); | ||
return chain( | ||
(options.entity | ||
? [ | ||
schematic('entity', { | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
flat: options.flat, | ||
skipTests: options.skipTests, | ||
module: options.module, | ||
reducers: options.reducers, | ||
group: options.group, | ||
feature: true, | ||
}), | ||
] | ||
: [ | ||
schematic('action', { | ||
flat: options.flat, | ||
group: options.group, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
schematic('reducer', { | ||
flat: options.flat, | ||
group: options.group, | ||
module: options.module, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
reducers: options.reducers, | ||
feature: true, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
schematic('selector', { | ||
flat: options.flat, | ||
group: options.group, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
feature: true, | ||
}), | ||
] | ||
).concat([ | ||
schematic('effect', { | ||
flat: options.flat, | ||
group: options.group, | ||
module: options.module, | ||
name: options.name, | ||
path: options.path, | ||
project: options.project, | ||
skipTests: options.skipTests, | ||
feature: true, | ||
api: options.api, | ||
prefix: options.prefix, | ||
}), | ||
]) | ||
)(host, context); | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,6 @@ export interface Schema { | |
api?: boolean; | ||
|
||
prefix?: string; | ||
|
||
entity?: boolean; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we use snapshot tests for this