Skip to content

Commit fb6a9e0

Browse files
author
Peter Smith
committed
feat(schematics): include @ngrx/schematics in ng add command
Assuming a user of the plugin is using it in a project with @ngrx/schematics then there is no benefit. If a user has not installed @ngrx/schematics then this will protect them from a "collection not found" error.
1 parent 9d1c3a0 commit fb6a9e0

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import {
2-
chain,
3-
Rule,
1+
import {
2+
chain,
3+
Rule
44
} from '@angular-devkit/schematics';
5+
import { addDepsToPackageJson } from '@nrwl/workspace';
56
import { initLintingRules } from '../rules';
7+
import { NGRX_VERSION } from '../utils';
68

79
export default function(): Rule {
810
return chain([
911
initLintingRules(),
12+
addDepsToPackageJson({
13+
'@ngrx/schematics': NGRX_VERSION
14+
})
1015
]);
1116
}

libs/ddd/src/schematics/rules/add-ngrx-to-package-json.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
*/
44
import { Rule } from '@angular-devkit/schematics';
55
import { addDepsToPackageJson } from '@nrwl/workspace';
6+
import { NGRX_VERSION } from '../utils';
67

78
/**
89
* addNgRxToPackageJson
910
* add the ngrx packages to the package.json and install them
1011
*/
1112
export function addNgRxToPackageJson(): Rule {
12-
const ngrxVersion = '10.0.0';
13-
1413
return addDepsToPackageJson(
1514
{
16-
'@ngrx/store': ngrxVersion,
17-
'@ngrx/effects': ngrxVersion,
18-
'@ngrx/entity': ngrxVersion,
19-
'@ngrx/store-devtools': ngrxVersion,
15+
'@ngrx/store': NGRX_VERSION,
16+
'@ngrx/effects': NGRX_VERSION,
17+
'@ngrx/entity': NGRX_VERSION,
18+
'@ngrx/store-devtools': NGRX_VERSION,
2019
},
2120
{}
2221
);
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
export * from './read-into-source-file';
21
export * from './check-rule-exists';
2+
export * from './insert';
3+
export * from './ngrx-version';
4+
export * from './read-into-source-file';
35
export * from './read-workspace-name';
4-
export * from './validate-inputs';
56
export * from './update-dep-const';
6-
export * from './insert';
7+
export * from './validate-inputs';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const NGRX_VERSION = '10.1.2';

0 commit comments

Comments
 (0)