@ngrx/schematics
Advanced tools
Comparing version 13.2.0 to 14.0.0-beta.0
{ | ||
"name": "@ngrx/schematics", | ||
"version": "13.2.0", | ||
"version": "14.0.0-beta.0", | ||
"description": "NgRx Schematics for Angular", | ||
@@ -37,3 +37,4 @@ "repository": { | ||
"@ngrx/component-store", | ||
"@ngrx/component" | ||
"@ngrx/component", | ||
"@ngrx/eslint-plugin" | ||
], | ||
@@ -40,0 +41,0 @@ "migrations": "./migrations/migration.json" |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -143,3 +143,3 @@ "use strict"; | ||
if (!lastItem && fallbackPos == undefined) { | ||
throw new Error("tried to insert " + toInsert + " as first occurence with no fallback position"); | ||
throw new Error("tried to insert ".concat(toInsert, " as first occurence with no fallback position")); | ||
} | ||
@@ -296,3 +296,3 @@ var lastItemPosition = lastItem ? lastItem.end : fallbackPos; | ||
position_1 = expr.getEnd() - 1; | ||
toInsert_1 = " " + metadataField + ": [" + symbolName + "]\n"; | ||
toInsert_1 = " ".concat(metadataField, ": [").concat(symbolName, "]\n"); | ||
} | ||
@@ -306,6 +306,6 @@ else { | ||
if (matches.length > 0) { | ||
toInsert_1 = "," + matches[0] + metadataField + ": [" + symbolName + "]"; | ||
toInsert_1 = ",".concat(matches[0]).concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
else { | ||
toInsert_1 = ", " + metadataField + ": [" + symbolName + "]"; | ||
toInsert_1 = ", ".concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
@@ -366,6 +366,6 @@ } | ||
if (text.match('^\r?\r?\n')) { | ||
effectInsert = "," + text.match(/^\r?\n\s+/)[0] + effectsSymbol; | ||
effectInsert = ",".concat(text.match(/^\r?\n\s+/)[0]).concat(effectsSymbol); | ||
} | ||
else { | ||
effectInsert = ", " + effectsSymbol; | ||
effectInsert = ", ".concat(effectsSymbol); | ||
} | ||
@@ -388,3 +388,3 @@ return [new change_1.InsertChange(ngModulePath, epos, effectInsert)]; | ||
position = expr.getEnd() - 1; | ||
toInsert = " " + metadataField + ": [" + symbolName + "]\n"; | ||
toInsert = " ".concat(metadataField, ": [").concat(symbolName, "]\n"); | ||
} | ||
@@ -397,6 +397,6 @@ else { | ||
if (text.match('^\r?\r?\n')) { | ||
toInsert = "," + text.match(/^\r?\n\s+/)[0] + metadataField + ": [" + symbolName + "]"; | ||
toInsert = ",".concat(text.match(/^\r?\n\s+/)[0]).concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
else { | ||
toInsert = ", " + metadataField + ": [" + symbolName + "]"; | ||
toInsert = ", ".concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
@@ -408,3 +408,3 @@ } | ||
position--; | ||
toInsert = "" + symbolName; | ||
toInsert = "".concat(symbolName); | ||
} | ||
@@ -415,6 +415,6 @@ else { | ||
if (text.match(/^\r?\n/)) { | ||
toInsert = "," + text.match(/^\r?\n(\r?)\s+/)[0] + symbolName; | ||
toInsert = ",".concat(text.match(/^\r?\n(\r?)\s+/)[0]).concat(symbolName); | ||
} | ||
else { | ||
toInsert = ", " + symbolName; | ||
toInsert = ", ".concat(symbolName); | ||
} | ||
@@ -459,3 +459,3 @@ } | ||
position_2 = expr.getEnd() - 1; | ||
toInsert_2 = " " + metadataField + ": [" + symbolName + "]\n"; | ||
toInsert_2 = " ".concat(metadataField, ": [").concat(symbolName, "]\n"); | ||
} | ||
@@ -469,6 +469,6 @@ else { | ||
if (matches.length > 0) { | ||
toInsert_2 = "," + matches[0] + metadataField + ": [" + symbolName + "]"; | ||
toInsert_2 = ",".concat(matches[0]).concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
else { | ||
toInsert_2 = ", " + metadataField + ": [" + symbolName + "]"; | ||
toInsert_2 = ", ".concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
@@ -513,3 +513,3 @@ } | ||
position = expr.getEnd() - 1; | ||
toInsert = " " + metadataField + ": [" + symbolName + "]\n"; | ||
toInsert = " ".concat(metadataField, ": [").concat(symbolName, "]\n"); | ||
} | ||
@@ -522,6 +522,6 @@ else { | ||
if (text.match('^\r?\r?\n')) { | ||
toInsert = "," + text.match(/^\r?\n\s+/)[0] + metadataField + ": [" + symbolName + "]"; | ||
toInsert = ",".concat(text.match(/^\r?\n\s+/)[0]).concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
else { | ||
toInsert = ", " + metadataField + ": [" + symbolName + "]"; | ||
toInsert = ", ".concat(metadataField, ": [").concat(symbolName, "]"); | ||
} | ||
@@ -533,3 +533,3 @@ } | ||
position--; | ||
toInsert = "" + symbolName; | ||
toInsert = "".concat(symbolName); | ||
} | ||
@@ -540,6 +540,6 @@ else { | ||
if (text.match(/^\r?\n/)) { | ||
toInsert = "," + text.match(/^\r?\n(\r?)\s+/)[0] + symbolName; | ||
toInsert = ",".concat(text.match(/^\r?\n(\r?)\s+/)[0]).concat(symbolName); | ||
} | ||
else { | ||
toInsert = ", " + symbolName; | ||
toInsert = ", ".concat(symbolName); | ||
} | ||
@@ -636,3 +636,3 @@ } | ||
findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart(); | ||
return insertAfterLastOccurrence(imports_1, ", " + symbolName, fileToEdit, fallbackPos_1); | ||
return insertAfterLastOccurrence(imports_1, ", ".concat(symbolName), fileToEdit, fallbackPos_1); | ||
} | ||
@@ -652,4 +652,4 @@ return new change_1.NoopChange(); | ||
var separator = insertAtBeginning ? '' : ';\n'; | ||
var toInsert = separator + "import " + open + symbolName + close + | ||
(" from '" + fileName + "'" + (insertAtBeginning ? ';\n' : '')); | ||
var toInsert = "".concat(separator, "import ").concat(open).concat(symbolName).concat(close) + | ||
" from '".concat(fileName, "'").concat(insertAtBeginning ? ';\n' : ''); | ||
return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral); | ||
@@ -663,4 +663,4 @@ } | ||
var moduleSpecifier = _a.moduleSpecifier; | ||
return moduleSpecifier.getText(sourceFile) === "'" + importFrom + "'" || | ||
moduleSpecifier.getText(sourceFile) === "\"" + importFrom + "\""; | ||
return moduleSpecifier.getText(sourceFile) === "'".concat(importFrom, "'") || | ||
moduleSpecifier.getText(sourceFile) === "\"".concat(importFrom, "\""); | ||
}); | ||
@@ -667,0 +667,0 @@ if (imports.length === 0) { |
@@ -41,3 +41,3 @@ "use strict"; | ||
} | ||
this.description = "Inserted " + toAdd + " into position " + pos + " of " + path; | ||
this.description = "Inserted ".concat(toAdd, " into position ").concat(pos, " of ").concat(path); | ||
this.order = pos; | ||
@@ -53,3 +53,3 @@ } | ||
var suffix = content.substring(_this.pos); | ||
return host.write(_this.path, "" + prefix + _this.toAdd + suffix); | ||
return host.write(_this.path, "".concat(prefix).concat(_this.toAdd).concat(suffix)); | ||
}); | ||
@@ -71,3 +71,3 @@ }; | ||
} | ||
this.description = "Removed text in position " + pos + " to " + end + " of " + path; | ||
this.description = "Removed text in position ".concat(pos, " to ").concat(end, " of ").concat(path); | ||
this.order = pos; | ||
@@ -81,3 +81,3 @@ } | ||
// TODO: throw error if toRemove doesn't match removed string. | ||
return host.write(_this.path, "" + prefix + suffix); | ||
return host.write(_this.path, "".concat(prefix).concat(suffix)); | ||
}); | ||
@@ -100,3 +100,3 @@ }; | ||
} | ||
this.description = "Replaced " + oldText + " into position " + pos + " of " + path + " with " + newText; | ||
this.description = "Replaced ".concat(oldText, " into position ").concat(pos, " of ").concat(path, " with ").concat(newText); | ||
this.order = pos; | ||
@@ -111,6 +111,6 @@ } | ||
if (text !== _this.oldText) { | ||
return Promise.reject(new Error("Invalid replace: \"" + text + "\" != \"" + _this.oldText + "\".")); | ||
return Promise.reject(new Error("Invalid replace: \"".concat(text, "\" != \"").concat(_this.oldText, "\"."))); | ||
} | ||
// TODO: throw error if oldText doesn't match removed string. | ||
return host.write(_this.path, "" + prefix + _this.newText + suffix); | ||
return host.write(_this.path, "".concat(prefix).concat(_this.newText).concat(suffix)); | ||
}); | ||
@@ -117,0 +117,0 @@ }; |
@@ -15,3 +15,3 @@ "use strict"; | ||
if (configBuffer === null) { | ||
throw new schematics_1.SchematicsException("Could not find (" + path + ")"); | ||
throw new schematics_1.SchematicsException("Could not find (".concat(path, ")")); | ||
} | ||
@@ -18,0 +18,0 @@ var config = configBuffer.toString(); |
@@ -40,3 +40,3 @@ "use strict"; | ||
else { | ||
throw new Error("Specified component path " + componentPath + " does not exist"); | ||
throw new Error("Specified component path ".concat(componentPath, " does not exist")); | ||
} | ||
@@ -76,8 +76,8 @@ } | ||
? relativePath | ||
: "./" + relativePath; | ||
: "./".concat(relativePath); | ||
return !toFileName || toFileName === 'index.ts' | ||
? fixedRelativePath | ||
: "" + (fixedRelativePath.endsWith('/') | ||
: "".concat(fixedRelativePath.endsWith('/') | ||
? fixedRelativePath | ||
: fixedRelativePath + '/') + convertToTypeScriptFileName(toFileName); | ||
: fixedRelativePath + '/').concat(convertToTypeScriptFileName(toFileName)); | ||
} | ||
@@ -84,0 +84,0 @@ exports.buildRelativePath = buildRelativePath; |
@@ -40,3 +40,3 @@ "use strict"; | ||
else { | ||
throw new Error("Specified module path " + modulePath + " does not exist"); | ||
throw new Error("Specified module path ".concat(modulePath, " does not exist")); | ||
} | ||
@@ -77,8 +77,8 @@ } | ||
? relativePath | ||
: "./" + relativePath; | ||
: "./".concat(relativePath); | ||
return !toFileName || toFileName === 'index.ts' | ||
? fixedRelativePath | ||
: "" + (fixedRelativePath.endsWith('/') | ||
: "".concat(fixedRelativePath.endsWith('/') | ||
? fixedRelativePath | ||
: fixedRelativePath + '/') + convertToTypeScriptFileName(toFileName); | ||
: fixedRelativePath + '/').concat(convertToTypeScriptFileName(toFileName)); | ||
} | ||
@@ -85,0 +85,0 @@ exports.buildRelativePath = buildRelativePath; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^13.2.0'; | ||
exports.platformVersion = '^14.0.0-beta.0'; | ||
//# sourceMappingURL=libs-version.js.map |
@@ -53,13 +53,13 @@ "use strict"; | ||
} | ||
var reducersPath = (0, core_1.normalize)("/" + options.path + "/" + options.reducers); | ||
var reducersPath = (0, core_1.normalize)("/".concat(options.path, "/").concat(options.reducers)); | ||
if (!host.exists(reducersPath)) { | ||
throw new Error("Specified reducers path " + reducersPath + " does not exist"); | ||
throw new Error("Specified reducers path ".concat(reducersPath, " does not exist")); | ||
} | ||
var text = host.read(reducersPath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + reducersPath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(reducersPath, " does not exist.")); | ||
} | ||
var sourceText = text.toString('utf-8'); | ||
var source = ts.createSourceFile(reducersPath, sourceText, ts.ScriptTarget.Latest, true); | ||
var reducerPath = "/" + options.path + "/" + | ||
var reducerPath = "/".concat(options.path, "/") + | ||
(options.flat ? '' : stringUtils.dasherize(options.name) + '/') + | ||
@@ -70,3 +70,3 @@ (options.group ? 'reducers/' : '') + | ||
var relativePath = (0, find_module_1.buildRelativePath)(reducersPath, reducerPath); | ||
var reducerImport = (0, ast_utils_1.insertImport)(source, reducersPath, "* as from" + stringUtils.classify(options.name), relativePath, true); | ||
var reducerImport = (0, ast_utils_1.insertImport)(source, reducersPath, "* as from".concat(stringUtils.classify(options.name)), relativePath, true); | ||
var stateInterfaceInsert = addReducerToStateInterface(source, reducersPath, options); | ||
@@ -108,3 +108,3 @@ var reducerMapInsert = addReducerToActionReducerMap(source, reducersPath, options); | ||
: stringUtils.camelize(options.name); | ||
var keyInsert = "[from" + stringUtils.classify(options.name) + "." + stringUtils.camelize(state) + "FeatureKey]: from" + stringUtils.classify(options.name) + ".State;"; | ||
var keyInsert = "[from".concat(stringUtils.classify(options.name), ".").concat(stringUtils.camelize(state), "FeatureKey]: from").concat(stringUtils.classify(options.name), ".State;"); | ||
var expr = node; | ||
@@ -115,3 +115,3 @@ var position; | ||
position = expr.getEnd() - 1; | ||
toInsert = " " + keyInsert + "\n"; | ||
toInsert = " ".concat(keyInsert, "\n"); | ||
} | ||
@@ -125,6 +125,6 @@ else { | ||
if (matches && matches.length > 0) { | ||
toInsert = "" + matches[1] + keyInsert + "\n"; | ||
toInsert = "".concat(matches[1]).concat(keyInsert, "\n"); | ||
} | ||
else { | ||
toInsert = "\n" + keyInsert; | ||
toInsert = "\n".concat(keyInsert); | ||
} | ||
@@ -161,3 +161,3 @@ } | ||
: stringUtils.camelize(options.name); | ||
var keyInsert = "[from" + stringUtils.classify(options.name) + "." + stringUtils.camelize(state) + "FeatureKey]: from" + stringUtils.classify(options.name) + ".reducer,"; | ||
var keyInsert = "[from".concat(stringUtils.classify(options.name), ".").concat(stringUtils.camelize(state), "FeatureKey]: from").concat(stringUtils.classify(options.name), ".reducer,"); | ||
var expr = node; | ||
@@ -168,3 +168,3 @@ var position; | ||
position = expr.getEnd() - 1; | ||
toInsert = " " + keyInsert + "\n"; | ||
toInsert = " ".concat(keyInsert, "\n"); | ||
} | ||
@@ -178,6 +178,6 @@ else { | ||
if (matches && matches.length > 0) { | ||
toInsert = "\n" + matches[1] + keyInsert; | ||
toInsert = "\n".concat(matches[1]).concat(keyInsert); | ||
} | ||
else { | ||
toInsert = "\n" + keyInsert; | ||
toInsert = "\n".concat(keyInsert); | ||
} | ||
@@ -199,7 +199,7 @@ } | ||
if (!host.exists(options.module)) { | ||
throw new Error("Specified module path " + modulePath + " does not exist"); | ||
throw new Error("Specified module path ".concat(modulePath, " does not exist")); | ||
} | ||
var text = host.read(modulePath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + modulePath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist.")); | ||
} | ||
@@ -211,3 +211,3 @@ var sourceText = text.toString('utf-8'); | ||
]; | ||
var reducerPath = "/" + options.path + "/" + | ||
var reducerPath = "/".concat(options.path, "/") + | ||
(options.flat ? '' : stringUtils.dasherize(options.name) + '/') + | ||
@@ -218,7 +218,7 @@ (options.group ? 'reducers/' : '') + | ||
var relativePath = (0, find_module_1.buildRelativePath)(modulePath, reducerPath); | ||
var reducerImport = (0, ast_utils_1.insertImport)(source, modulePath, "* as from" + stringUtils.classify(options.name), relativePath, true); | ||
var reducerImport = (0, ast_utils_1.insertImport)(source, modulePath, "* as from".concat(stringUtils.classify(options.name)), relativePath, true); | ||
var state = options.plural | ||
? stringUtils.pluralize(options.name) | ||
: stringUtils.camelize(options.name); | ||
var _b = __read((0, ast_utils_1.addImportToModule)(source, modulePath, "StoreModule.forFeature(from" + stringUtils.classify(options.name) + "." + state + "FeatureKey, from" + stringUtils.classify(options.name) + ".reducer)", relativePath), 1), storeNgModuleImport = _b[0]; | ||
var _b = __read((0, ast_utils_1.addImportToModule)(source, modulePath, "StoreModule.forFeature(from".concat(stringUtils.classify(options.name), ".").concat(state, "FeatureKey, from").concat(stringUtils.classify(options.name), ".reducer)"), relativePath), 1), storeNgModuleImport = _b[0]; | ||
var changes = __spreadArray(__spreadArray([], __read(commonImports), false), [reducerImport, storeNgModuleImport], false); | ||
@@ -256,7 +256,5 @@ var recorder = host.beginUpdate(modulePath); | ||
function getPrefix(options) { | ||
return options.creators | ||
? stringUtils.camelize(options.prefix || 'load') | ||
: stringUtils.capitalize(options.prefix || 'load'); | ||
return stringUtils.camelize(options.prefix || 'load'); | ||
} | ||
exports.getPrefix = getPrefix; | ||
//# sourceMappingURL=ngrx-utils.js.map |
@@ -20,8 +20,8 @@ "use strict"; | ||
var project = getProject(host, options); | ||
if (project.root.substr(-1) === '/') { | ||
project.root = project.root.substr(0, project.root.length - 1); | ||
if (project.root.slice(-1) === '/') { | ||
project.root = project.root.substring(0, project.root.length - 1); | ||
} | ||
if (options.path === undefined) { | ||
var projectDirName = project.projectType === 'application' ? 'app' : 'lib'; | ||
return (project.root ? "/" + project.root : '') + "/src/" + projectDirName; | ||
return "".concat(project.root ? "/".concat(project.root) : '', "/src/").concat(projectDirName); | ||
} | ||
@@ -28,0 +28,0 @@ return options.path; |
@@ -109,3 +109,3 @@ "use strict"; | ||
function capitalize(str) { | ||
return str.charAt(0).toUpperCase() + str.substr(1); | ||
return str.charAt(0).toUpperCase() + str.substring(1); | ||
} | ||
@@ -125,7 +125,7 @@ exports.capitalize = capitalize; | ||
function pluralize(str) { | ||
return camelize([/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(function (c, i) { return (str = str.replace(c, "$1" + ('iv'[i] || '') + "e")); }) && str + 's'); | ||
return camelize([/([^aeiou])y$/, /()fe?$/, /([^aeiou]o|[sxz]|[cs]h)$/].map(function (c, i) { return (str = str.replace(c, "$1".concat('iv'[i] || '', "e"))); }) && str + 's'); | ||
} | ||
exports.pluralize = pluralize; | ||
function group(name, group) { | ||
return group ? group + "/" + name : name; | ||
return group ? "".concat(group, "/").concat(name) : name; | ||
} | ||
@@ -135,7 +135,7 @@ exports.group = group; | ||
if (group && !flat) { | ||
return "../../" + path + "/" + name + "/"; | ||
return "../../".concat(path, "/").concat(name, "/"); | ||
} | ||
return group ? "../" + path + "/" : './'; | ||
return group ? "../".concat(path, "/") : './'; | ||
} | ||
exports.featurePath = featurePath; | ||
//# sourceMappingURL=strings.js.map |
@@ -19,7 +19,7 @@ "use strict"; | ||
dependencyCategories.forEach(function (category) { | ||
var packageName = "@ngrx/" + name; | ||
var packageName = "@ngrx/".concat(name); | ||
if (pkg[category] && pkg[category][packageName]) { | ||
var firstChar = pkg[category][packageName][0]; | ||
var suffix = match(firstChar, '^') || match(firstChar, '~'); | ||
pkg[category][packageName] = suffix + "6.0.0"; | ||
pkg[category][packageName] = "".concat(suffix, "6.0.0"); | ||
} | ||
@@ -26,0 +26,0 @@ }); |
@@ -23,6 +23,3 @@ "use strict"; | ||
options.path = parsedPath.path; | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)(options.creators ? './creator-files' : './files'), [ | ||
options.skipTests | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
@@ -29,0 +26,0 @@ return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'actions' : ''); |
@@ -33,7 +33,2 @@ { | ||
}, | ||
"skipTests": { | ||
"type": "boolean", | ||
"description": "When true, does not create test files.", | ||
"default": false | ||
}, | ||
"flat": { | ||
@@ -56,9 +51,2 @@ "type": "boolean", | ||
"x-prompt": "Should we generate success and failure actions?" | ||
}, | ||
"creators": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies whether to use creator functions for handling actions and reducers.", | ||
"aliases": ["c"], | ||
"x-prompt": "Do you want to use the create function?" | ||
} | ||
@@ -65,0 +53,0 @@ }, |
@@ -46,4 +46,4 @@ "use strict"; | ||
function createProvidingContext(options, providingPath) { | ||
var componentStoreName = "" + schematics_core_1.stringUtils.classify(options.name + "Store"); | ||
var componentStorePath = "/" + options.path + "/" + | ||
var componentStoreName = "".concat(schematics_core_1.stringUtils.classify("".concat(options.name, "Store"))); | ||
var componentStorePath = "/".concat(options.path, "/") + | ||
(options.flat ? '' : schematics_core_1.stringUtils.dasherize(options.name) + '/') + | ||
@@ -69,7 +69,7 @@ schematics_core_1.stringUtils.dasherize(options.name) + | ||
if (!host.exists(options.module)) { | ||
throw new Error("Specified module path " + modulePath + " does not exist"); | ||
throw new Error("Specified module path ".concat(modulePath, " does not exist")); | ||
} | ||
var text = host.read(modulePath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + modulePath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist.")); | ||
} | ||
@@ -114,7 +114,7 @@ var sourceText = text.toString('utf-8'); | ||
if (!host.exists(options.component)) { | ||
throw new Error("Specified component path " + componentPath + " does not exist"); | ||
throw new Error("Specified component path ".concat(componentPath, " does not exist")); | ||
} | ||
var text = host.read(componentPath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + componentPath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(componentPath, " does not exist.")); | ||
} | ||
@@ -121,0 +121,0 @@ var sourceText = text.toString('utf-8'); |
@@ -50,9 +50,9 @@ "use strict"; | ||
} | ||
var statePath = "/" + options.path + "/" + options.state; | ||
var statePath = "/".concat(options.path, "/").concat(options.state); | ||
if (options.state) { | ||
if (!host.exists(statePath)) { | ||
throw new Error("The Specified state path " + statePath + " does not exist"); | ||
throw new Error("The Specified state path ".concat(statePath, " does not exist")); | ||
} | ||
} | ||
var componentPath = "/" + options.path + "/" + | ||
var componentPath = "/".concat(options.path, "/") + | ||
(options.flat ? '' : schematics_core_1.stringUtils.dasherize(options.name) + '/') + | ||
@@ -63,3 +63,3 @@ schematics_core_1.stringUtils.dasherize(options.name) + | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + componentPath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(componentPath, " does not exist.")); | ||
} | ||
@@ -81,3 +81,3 @@ var sourceText = text.toString('utf-8'); | ||
var storeConstructor = [start, "(private store: Store)", end].join(''); | ||
var constructorUpdate = new schematics_core_1.ReplaceChange(componentPath, pos, " " + constructorText + "\n\n", "\n\n " + storeConstructor); | ||
var constructorUpdate = new schematics_core_1.ReplaceChange(componentPath, pos, " ".concat(constructorText, "\n\n"), "\n\n ".concat(storeConstructor)); | ||
var changes = [storeImport, stateImport, constructorUpdate]; | ||
@@ -84,0 +84,0 @@ var recorder = host.beginUpdate(componentPath); |
@@ -52,13 +52,13 @@ "use strict"; | ||
if (!host.exists(modulePath)) { | ||
throw new Error("Specified module path " + modulePath + " does not exist"); | ||
throw new Error("Specified module path ".concat(modulePath, " does not exist")); | ||
} | ||
var text = host.read(modulePath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + modulePath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist.")); | ||
} | ||
var sourceText = text.toString('utf-8'); | ||
var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true); | ||
var effectsName = "" + schematics_core_1.stringUtils.classify(options.name + "Effects"); | ||
var effectsName = "".concat(schematics_core_1.stringUtils.classify("".concat(options.name, "Effects"))); | ||
var effectsModuleImport = (0, schematics_core_1.insertImport)(source, modulePath, 'EffectsModule', '@ngrx/effects'); | ||
var effectsPath = "/" + options.path + "/" + | ||
var effectsPath = "/".concat(options.path, "/") + | ||
(options.flat ? '' : schematics_core_1.stringUtils.dasherize(options.name) + '/') + | ||
@@ -70,4 +70,4 @@ (options.group ? 'effects/' : '') + | ||
var effectsImport = (0, schematics_core_1.insertImport)(source, modulePath, effectsName, relativePath); | ||
var effectsSetup = options.root && options.minimal ? "[]" : "[" + effectsName + "]"; | ||
var _b = __read((0, schematics_core_1.addImportToModule)(source, modulePath, "EffectsModule.for" + (options.root ? 'Root' : 'Feature') + "(" + effectsSetup + ")", relativePath), 1), effectsNgModuleImport = _b[0]; | ||
var effectsSetup = options.root && options.minimal ? "[]" : "[".concat(effectsName, "]"); | ||
var _b = __read((0, schematics_core_1.addImportToModule)(source, modulePath, "EffectsModule.for".concat(options.root ? 'Root' : 'Feature', "(").concat(effectsSetup, ")"), relativePath), 1), effectsNgModuleImport = _b[0]; | ||
var changes = [effectsModuleImport, effectsNgModuleImport]; | ||
@@ -97,17 +97,8 @@ if (!options.root || (options.root && !options.minimal)) { | ||
} | ||
function getEffectMethod(creators) { | ||
return creators ? 'createEffect' : 'Effect'; | ||
} | ||
function getEffectStart(name, effectPrefix, creators) { | ||
function getEffectStart(name, effectPrefix) { | ||
var effectName = schematics_core_1.stringUtils.classify(name); | ||
var effectMethodPrefix = schematics_core_1.stringUtils.camelize(effectPrefix); | ||
return creators | ||
? "" + effectMethodPrefix + effectName + "s$ = createEffect(() => {" + | ||
'\n return this.actions$.pipe( \n' | ||
: '@Effect()\n' + | ||
(" " + effectMethodPrefix + effectName + "s$ = this.actions$.pipe("); | ||
return ("".concat(effectMethodPrefix).concat(effectName, "s$ = createEffect(() => {") + | ||
'\n return this.actions$.pipe( \n'); | ||
} | ||
function getEffectEnd(creators) { | ||
return creators ? ' );\n' + ' });' : ');'; | ||
} | ||
function default_1(options) { | ||
@@ -130,3 +121,3 @@ return function (host, context) { | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'effects' : ''); | ||
}, effectMethod: getEffectMethod(options.creators), effectStart: getEffectStart(options.name, options.prefix, options.creators), effectEnd: getEffectEnd(options.creators) }), options)), | ||
}, effectMethod: 'createEffect', effectStart: getEffectStart(options.name, options.prefix), effectEnd: ' );\n' + ' });' }), options)), | ||
(0, schematics_1.move)(parsedPath.path), | ||
@@ -133,0 +124,0 @@ ]); |
@@ -68,9 +68,2 @@ { | ||
}, | ||
"creators": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies whether to use creator functions for handling actions, reducers, and effects.", | ||
"aliases": ["c"], | ||
"x-prompt": "Do you want to use the create function?" | ||
}, | ||
"minimal": { | ||
@@ -77,0 +70,0 @@ "type": "boolean", |
@@ -33,3 +33,3 @@ "use strict"; | ||
} }), options); | ||
var commonTemplates = (0, schematics_1.apply)((0, schematics_1.url)('./common-files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
@@ -41,7 +41,6 @@ ? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
]); | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)(options.creators ? './creator-files' : './files'), [(0, schematics_1.applyTemplates)(templateOptions), (0, schematics_1.move)(parsedPath.path)]); | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_core_1.addReducerToState)(__assign(__assign({}, options), { plural: true })), | ||
(0, schematics_core_1.addReducerImportToNgModule)(__assign(__assign({}, options), { plural: true })), | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(commonTemplates), (0, schematics_1.mergeWith)(templateSource)])), | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)(templateSource)), | ||
])(host, context); | ||
@@ -48,0 +47,0 @@ }; |
@@ -52,9 +52,2 @@ { | ||
"aliases": ["g"] | ||
}, | ||
"creators": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies whether to use creator functions for handling actions and reducers.", | ||
"aliases": ["c"], | ||
"x-prompt": "Do you want to use the create function?" | ||
} | ||
@@ -61,0 +54,0 @@ }, |
@@ -15,3 +15,2 @@ "use strict"; | ||
api: options.api, | ||
creators: options.creators, | ||
prefix: options.prefix | ||
@@ -30,3 +29,2 @@ }), | ||
api: options.api, | ||
creators: options.creators, | ||
prefix: options.prefix | ||
@@ -44,3 +42,2 @@ }), | ||
api: options.api, | ||
creators: options.creators, | ||
prefix: options.prefix | ||
@@ -47,0 +44,0 @@ }), |
@@ -60,9 +60,2 @@ { | ||
}, | ||
"creators": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies if the actions, reducers, and effects should be created using creator functions", | ||
"aliases": ["c"], | ||
"x-prompt": "Do you want to use the create functions?" | ||
}, | ||
"prefix": { | ||
@@ -69,0 +62,0 @@ "description": "The prefix of the action, effect and reducer.", |
@@ -30,3 +30,3 @@ "use strict"; | ||
} }), options); | ||
var commonTemplate = (0, schematics_1.apply)((0, schematics_1.url)('./common-files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
@@ -38,10 +38,5 @@ ? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
]); | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)(options.creators ? './creator-files' : './files'), [(0, schematics_1.applyTemplates)(templateOptions), (0, schematics_1.move)(parsedPath.path)]); | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_core_1.addReducerToState)(options)])), | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([ | ||
(0, schematics_core_1.addReducerImportToNgModule)(options), | ||
(0, schematics_1.mergeWith)(commonTemplate), | ||
(0, schematics_1.mergeWith)(templateSource), | ||
])), | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_core_1.addReducerImportToNgModule)(options), (0, schematics_1.mergeWith)(templateSource)])), | ||
])(host, context); | ||
@@ -48,0 +43,0 @@ }; |
@@ -64,9 +64,2 @@ { | ||
"x-prompt": "Should we add success and failure actions to the reducer?" | ||
}, | ||
"creators": { | ||
"type": "boolean", | ||
"default": true, | ||
"description": "Specifies whether to use creator functions for handling actions and reducers.", | ||
"aliases": ["c"], | ||
"x-prompt": "Do you want to use the create function?" | ||
} | ||
@@ -73,0 +66,0 @@ }, |
@@ -28,3 +28,3 @@ "use strict"; | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'selectors' : ''); | ||
}, reducerPath: "" + relativePath(options) + schematics_core_1.stringUtils.dasherize(options.name) + ".reducer" }), options)), | ||
}, reducerPath: "".concat(relativePath(options)).concat(schematics_core_1.stringUtils.dasherize(options.name), ".reducer") }), options)), | ||
(0, schematics_1.move)(parsedPath.path), | ||
@@ -31,0 +31,0 @@ ]); |
@@ -62,18 +62,18 @@ "use strict"; | ||
if (!host.exists(modulePath)) { | ||
throw new Error("Specified module path " + modulePath + " does not exist"); | ||
throw new Error("Specified module path ".concat(modulePath, " does not exist")); | ||
} | ||
var text = host.read(modulePath); | ||
if (text === null) { | ||
throw new schematics_1.SchematicsException("File " + modulePath + " does not exist."); | ||
throw new schematics_1.SchematicsException("File ".concat(modulePath, " does not exist.")); | ||
} | ||
var sourceText = text.toString('utf-8'); | ||
var source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true); | ||
var statePath = options.path + "/" + options.statePath; | ||
var statePath = "".concat(options.path, "/").concat(options.statePath); | ||
var relativePath = (0, schematics_core_1.buildRelativePath)(modulePath, statePath); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, options.path + "/environments/environment"); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, "".concat(options.path, "/environments/environment")); | ||
var rootStoreReducers = options.minimal ? "{}" : "reducers"; | ||
var rootStoreConfig = options.minimal ? "" : ", { metaReducers }"; | ||
var storeNgModuleImport = (0, schematics_core_1.addImportToModule)(source, modulePath, options.root | ||
? "StoreModule.forRoot(" + rootStoreReducers + rootStoreConfig + ")" | ||
: "StoreModule.forFeature(from" + schematics_core_1.stringUtils.classify(options.name) + "." + schematics_core_1.stringUtils.camelize(options.name) + "FeatureKey, from" + schematics_core_1.stringUtils.classify(options.name) + ".reducers, { metaReducers: from" + schematics_core_1.stringUtils.classify(options.name) + ".metaReducers })", relativePath).shift(); | ||
? "StoreModule.forRoot(".concat(rootStoreReducers).concat(rootStoreConfig, ")") | ||
: "StoreModule.forFeature(from".concat(schematics_core_1.stringUtils.classify(options.name), ".").concat(schematics_core_1.stringUtils.camelize(options.name), "FeatureKey, from").concat(schematics_core_1.stringUtils.classify(options.name), ".reducers, { metaReducers: from").concat(schematics_core_1.stringUtils.classify(options.name), ".metaReducers })"), relativePath).shift(); | ||
var commonImports = [ | ||
@@ -90,3 +90,3 @@ (0, schematics_core_1.insertImport)(source, modulePath, 'StoreModule', '@ngrx/store'), | ||
commonImports = commonImports.concat([ | ||
(0, schematics_core_1.insertImport)(source, modulePath, "* as from" + schematics_core_1.stringUtils.classify(options.name), relativePath, true), | ||
(0, schematics_core_1.insertImport)(source, modulePath, "* as from".concat(schematics_core_1.stringUtils.classify(options.name)), relativePath, true), | ||
]); | ||
@@ -104,3 +104,3 @@ } | ||
var adjectiveComma = hasImports_1 ? '' : ', '; | ||
var storeDevtoolsNgModuleImport = (0, schematics_core_1.addImportToModule)(source, modulePath, adjectiveComma + "!environment.production ? StoreDevtoolsModule.instrument() : []", relativePath).shift(); | ||
var storeDevtoolsNgModuleImport = (0, schematics_core_1.addImportToModule)(source, modulePath, "".concat(adjectiveComma, "!environment.production ? StoreDevtoolsModule.instrument() : []"), relativePath).shift(); | ||
rootImports = rootImports.concat([ | ||
@@ -142,5 +142,5 @@ (0, schematics_core_1.insertImport)(source, modulePath, 'StoreDevtoolsModule', '@ngrx/store-devtools'), | ||
options.path = parsedPath.path; | ||
var statePath = "/" + options.path + "/" + options.statePath + "/index.ts"; | ||
var statePath = "/".concat(options.path, "/").concat(options.statePath, "/index.ts"); | ||
var srcPath = (0, core_1.dirname)(options.path); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, srcPath + "/environments/environment"); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, "".concat(srcPath, "/environments/environment")); | ||
if (options.module) { | ||
@@ -147,0 +147,0 @@ options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
360710
120
3710
1