What is @ngrx/schematics?
@ngrx/schematics is a collection of Angular schematics for generating NgRx files such as actions, reducers, effects, and more. It helps streamline the process of setting up and maintaining NgRx in Angular applications.
What are @ngrx/schematics's main functionalities?
Generate Store
This command generates a new NgRx store with the specified state and sets it up in the root module. It creates necessary files and boilerplate code for the store.
ng generate @ngrx/schematics:store State --root --module app.module.ts
Generate Actions
This command generates a new set of actions for a specified feature (e.g., User). It creates an actions file with predefined action types and classes.
ng generate @ngrx/schematics:action User
Generate Reducer
This command generates a new reducer for a specified feature (e.g., User). It creates a reducer file with initial state, reducer function, and necessary imports.
ng generate @ngrx/schematics:reducer User
Generate Effects
This command generates a new effect for a specified feature (e.g., User). It creates an effects file with boilerplate code for handling side effects in NgRx.
ng generate @ngrx/schematics:effect User
Other packages similar to @ngrx/schematics
@angular/cli
@angular/cli is the official Angular CLI tool that provides a wide range of commands for generating and managing Angular projects. While it does not specifically focus on NgRx, it can be extended with custom schematics to include NgRx-related functionality.
nx
Nx is a set of extensible dev tools for monorepos, which helps you develop like Google, Facebook, and Microsoft. It provides powerful CLI commands for generating and managing Angular applications, including support for NgRx. Nx offers more advanced features for managing large-scale projects compared to @ngrx/schematics.
schematics-utilities
schematics-utilities is a utility library for Angular schematics that provides helper functions for creating and modifying Angular projects. It can be used to create custom schematics, including those for NgRx, but requires more manual setup compared to @ngrx/schematics.
5.0.0 (2018-01-22)
Bug Fixes
- Effects: Ensure Store modules are loaded eagerly (#658) (0a3398d), closes #642
- Effects: Remove toPayload utility function (#738) (b390ef5)
- Entity: updateOne/updateMany should not change ids state on existing entity (#581) (b989e4b), closes #571
- RouterStore: Fix usage of config object if provided (#575) (4125914)
- RouterStore: Match RouterAction type parameters (#562) (980a653)
- Schematics: Add group folder after feature name folder (#737) (317fb94)
- Schematics: Add handling of flat option to entity blueprint (fb8d2c6)
- Schematics: Distinguish between root and feature effect arrays when registering (#718) (95ff6c8)
- Schematics: Don't add state import if not provided (#697) (e5c2aed)
- Schematics: Make variable naming consistent for entity blueprint (#716) (765b15a)
- Store: Compose provided metareducers for a feature reducer (#704) (1454620), closes #701
- StoreDevtools: Only recompute current state when reducers are updated (#570) (247ae1a), closes #229 #487
- typo: update login error to use correct css font color property (41723fc)
Features
- Effects: Add lettable ofType operator (d5e1814)
- ErrorHandler: Use the Angular ErrorHandler for reporting errors (#667) (8f297d1), closes #626
- material: Upgrade @angular/material to v 2.0.0-beta.12 (#482) (aedf20e), closes #448
- Schematics: Add alias for container, store and action blueprints (#685) (dc64ac9)
- Schematics: Add alias for reducer blueprint (#684) (ea98fb7)
- Schematics: Add effect to registered effects array (#717) (f1082fe)
- Schematics: Add option to group feature blueprints in respective folders (#736) (b82c35d)
- Schematics: Introduce @ngrx/schematics (#631) (1837dba), closes #53
- Store: Add lettable select operator (77eed24)
- Store: Add support for generating custom createSelector functions (#734) (cb0d185), closes #478 #724
- StoreDevtools: Add option to configure extension in log-only mode (#712) (1ecd658), closes #643 #374
- StoreDevtools: Add support for custom instance name (#517) (00be3d1), closes #463
- StoreDevtools: Add support for extension sanitizers (#544) (6ed92b0), closes #494
- StoreDevtools: Add support for jumping to a specific action (#703) (b9f6442), closes #681
BREAKING CHANGES
-
Effects: The utility function toPayload
, deprecated in @ngrx/effects v4.0, has been removed.
Before:
import { toPayload } from '@ngrx/effects';
actions$.ofType('SOME_ACTION').map(toPayload);
After:
actions$.ofType('SOME_ACTION').map((action: SomeActionWithPayload) => action.payload);
-
ErrorHandler: The ErrorReporter has been replaced with ErrorHandler
from angular/core.
BEFORE:
Errors were reported to the ngrx/effects ErrorReporter. The
ErrorReporter would log to the console by default.
AFTER:
Errors are now reported to the @angular/core ErrorHandler.
- Store: Updates minimum version of RxJS dependency.
BEFORE:
Minimum peer dependency of RxJS ^5.0.0
AFTER:
Minimum peer dependency of RxJS ^5.5.0
- Effects: Updates minimum version of RxJS dependency.
BEFORE:
Minimum peer dependency of RxJS ^5.0.0
AFTER:
Minimum peer dependency of RxJS ^5.5.0
<a name="4.1.1"></a>