@ngrx/schematics
Advanced tools
Comparing version 5.0.0 to 5.1.0
{ | ||
"name": "@ngrx/schematics", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "NgRx Schematics for Angular", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -34,3 +34,4 @@ { | ||
"default": false, | ||
"description": "Group actions file within 'actions' folder" | ||
"description": "Group actions file within 'actions' folder", | ||
"aliases": ["g"] | ||
} | ||
@@ -37,0 +38,0 @@ }, |
@@ -40,2 +40,3 @@ "use strict"; | ||
var stateImportPath = find_module_1.buildRelativePath(componentPath, statePath); | ||
var storeImport = route_utils_1.insertImport(source, componentPath, 'Store', '@ngrx/store'); | ||
var stateImport = options.state | ||
@@ -56,4 +57,4 @@ ? route_utils_1.insertImport(source, componentPath, "* as fromStore", stateImportPath, true) | ||
var storeConstructor = [start, "(" + storeText + ")", end].join(''); | ||
var constructorUpdate = new change_1.ReplaceChange(componentPath, pos, " " + constructorText, "\n\n " + storeConstructor); | ||
var changes = [stateImport, constructorUpdate]; | ||
var constructorUpdate = new change_1.ReplaceChange(componentPath, pos, " " + constructorText + "\n\n", "\n\n " + storeConstructor); | ||
var changes = [storeImport, stateImport, constructorUpdate]; | ||
var recorder = host.beginUpdate(componentPath); | ||
@@ -60,0 +61,0 @@ for (var _i = 0, changes_1 = changes; _i < changes_1.length; _i++) { |
import { Injectable } from '@angular/core'; | ||
import { Actions, Effect } from '@ngrx/effects'; | ||
<% if(feature) { %>import { <%= classify(name) %>Actions, <%= classify(name) %>ActionTypes } from '<%= featurePath(group, "actions") %><%= dasherize(name) %>.actions';<% } %> | ||
<% if(feature) { %>import { <%= classify(name) %>Actions, <%= classify(name) %>ActionTypes } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions';<% } %> | ||
@@ -5,0 +5,0 @@ @Injectable() |
@@ -51,3 +51,4 @@ { | ||
"default": false, | ||
"description": "Group effects file within 'effects' folder" | ||
"description": "Group effects file within 'effects' folder", | ||
"aliases": ["g"] | ||
} | ||
@@ -54,0 +55,0 @@ }, |
@@ -28,3 +28,9 @@ "use strict"; | ||
options.spec ? schematics_1.noop() : schematics_1.filter(function (path) { return !path.endsWith('__spec.ts'); }), | ||
schematics_1.template(__assign({}, stringUtils, { 'if-flat': function (s) { return (options.flat ? '' : s); } }, options, { dot: function () { return '.'; } })), | ||
schematics_1.template(__assign({}, stringUtils, { 'if-flat': function (s) { return (options.flat ? '' : s); }, 'group-actions': function (name) { | ||
return stringUtils.group(name, options.group ? 'actions' : ''); | ||
}, 'group-models': function (name) { | ||
return stringUtils.group(name, options.group ? 'models' : ''); | ||
}, 'group-reducers': function (s) { | ||
return stringUtils.group(s, options.group ? 'reducers' : ''); | ||
} }, options, { dot: function () { return '.'; } })), | ||
schematics_1.move(sourceDir), | ||
@@ -31,0 +37,0 @@ ]); |
@@ -13,2 +13,3 @@ export interface Schema { | ||
flat?: boolean; | ||
group?: boolean; | ||
} |
@@ -40,2 +40,8 @@ { | ||
"description": "Flag to indicate if a dir is created." | ||
}, | ||
"group": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Group actions, reducers and effects within relative subfolders", | ||
"aliases": ["g"] | ||
} | ||
@@ -42,0 +48,0 @@ }, |
@@ -9,3 +9,3 @@ { | ||
"type": "string", | ||
"default": "src" | ||
"default": "app" | ||
}, | ||
@@ -43,3 +43,4 @@ "sourceDir": { | ||
"default": false, | ||
"description": "Group actions, reducers and effects within relative subfolders" | ||
"description": "Group actions, reducers and effects within relative subfolders", | ||
"aliases": ["g"] | ||
} | ||
@@ -46,0 +47,0 @@ }, |
import { Action } from '@ngrx/store'; | ||
<% if(feature) { %>import { <%= classify(name) %>Actions, <%= classify(name) %>ActionTypes } from '<%= featurePath(group, "actions") %><%= dasherize(name) %>.actions';<% } %> | ||
<% if(feature) { %>import { <%= classify(name) %>Actions, <%= classify(name) %>ActionTypes } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions';<% } %> | ||
@@ -4,0 +4,0 @@ export interface State { |
@@ -49,3 +49,4 @@ { | ||
"default": false, | ||
"description": "Group reducer file within 'reducers' folder" | ||
"description": "Group reducer file within 'reducers' folder", | ||
"aliases": ["g"] | ||
} | ||
@@ -52,0 +53,0 @@ }, |
@@ -93,3 +93,3 @@ /** | ||
export declare function capitalize(str: string): string; | ||
export declare function group(path: string, group: string | undefined): string; | ||
export declare function featurePath(group: boolean | undefined, path: string): string; | ||
export declare function group(name: string, group: string | undefined): string; | ||
export declare function featurePath(group: boolean | undefined, flat: boolean | undefined, path: string, name: string): string; |
@@ -135,7 +135,10 @@ "use strict"; | ||
exports.capitalize = capitalize; | ||
function group(path, group) { | ||
return group ? group + "/" + path : path; | ||
function group(name, group) { | ||
return group ? group + "/" + name : name; | ||
} | ||
exports.group = group; | ||
function featurePath(group, path) { | ||
function featurePath(group, flat, path, name) { | ||
if (group && !flat) { | ||
return "../../" + path + "/" + name + "/"; | ||
} | ||
return group ? "../" + path + "/" : './'; | ||
@@ -142,0 +145,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98996
2643