@ngrx/schematics
Advanced tools
Comparing version 13.0.0-beta.0 to 13.0.0-rc.0
@@ -5,5 +5,5 @@ "use strict"; | ||
function default_1() { | ||
return schematics_core_1.updatePackage('schematics'); | ||
return (0, schematics_core_1.updatePackage)('schematics'); | ||
} | ||
exports["default"] = default_1; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ngrx/schematics", | ||
"version": "13.0.0-beta.0", | ||
"version": "13.0.0-rc.0", | ||
"description": "NgRx Schematics for Angular", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -5,2 +5,3 @@ "use strict"; | ||
var core_1 = require("@angular-devkit/core"); | ||
var parser_1 = require("@angular-devkit/core/src/json/parser"); | ||
var json_utilts_1 = require("./json-utilts"); | ||
@@ -15,9 +16,9 @@ // https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/migrations/update-9/utils.ts | ||
} | ||
var tsCfgAst = core_1.parseJsonAst(buffer.toString(), core_1.JsonParseMode.Loose); | ||
var tsCfgAst = (0, parser_1.parseJsonAst)(buffer.toString()); | ||
if (tsCfgAst.kind !== 'object') { | ||
return true; | ||
} | ||
var ngCompilerOptions = json_utilts_1.findPropertyInAstObject(tsCfgAst, 'angularCompilerOptions'); | ||
var ngCompilerOptions = (0, json_utilts_1.findPropertyInAstObject)(tsCfgAst, 'angularCompilerOptions'); | ||
if (ngCompilerOptions && ngCompilerOptions.kind === 'object') { | ||
var enableIvy = json_utilts_1.findPropertyInAstObject(ngCompilerOptions, 'enableIvy'); | ||
var enableIvy = (0, json_utilts_1.findPropertyInAstObject)(ngCompilerOptions, 'enableIvy'); | ||
if (enableIvy) { | ||
@@ -27,5 +28,5 @@ return !!enableIvy.value; | ||
} | ||
var configExtends = json_utilts_1.findPropertyInAstObject(tsCfgAst, 'extends'); | ||
var configExtends = (0, json_utilts_1.findPropertyInAstObject)(tsCfgAst, 'extends'); | ||
if (configExtends && configExtends.kind === 'string') { | ||
var extendedTsConfigPath = core_1.resolve(core_1.dirname(core_1.normalize(tsConfigPath)), core_1.normalize(configExtends.value)); | ||
var extendedTsConfigPath = (0, core_1.resolve)((0, core_1.dirname)((0, core_1.normalize)(tsConfigPath)), (0, core_1.normalize)(configExtends.value)); | ||
return isIvyEnabled(tree, extendedTsConfigPath); | ||
@@ -32,0 +33,0 @@ } |
@@ -29,6 +29,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -104,3 +108,3 @@ exports.__esModule = true; | ||
if (node.getChildCount(sourceFile) >= 0) { | ||
nodes.unshift.apply(nodes, __spreadArray([], __read(node.getChildren()))); | ||
nodes.unshift.apply(nodes, __spreadArray([], __read(node.getChildren()), false)); | ||
} | ||
@@ -679,3 +683,3 @@ } | ||
if (!isAlreadyImported) { | ||
return change_1.createReplaceChange(sourceFile, specifier, importAsIs, importToBe); | ||
return (0, change_1.createReplaceChange)(sourceFile, specifier, importAsIs, importToBe); | ||
} | ||
@@ -685,6 +689,6 @@ var nextIdentifier = importSpecifiers[index + 1]; | ||
if (nextIdentifier) { | ||
return change_1.createRemoveChange(sourceFile, specifier, specifier.getStart(sourceFile), nextIdentifier.getStart(sourceFile)); | ||
return (0, change_1.createRemoveChange)(sourceFile, specifier, specifier.getStart(sourceFile), nextIdentifier.getStart(sourceFile)); | ||
} | ||
// there are no imports following, just remove it | ||
return change_1.createRemoveChange(sourceFile, specifier, specifier.getStart(sourceFile), specifier.getEnd()); | ||
return (0, change_1.createRemoveChange)(sourceFile, specifier, specifier.getStart(sourceFile), specifier.getEnd()); | ||
}); | ||
@@ -691,0 +695,0 @@ return importChanges.filter(Boolean); |
@@ -22,18 +22,18 @@ "use strict"; | ||
(options.flat ? '' : '/' + core_1.strings.dasherize(options.name)); | ||
return core_1.normalize(findComponent(host, pathToCheck)); | ||
return (0, core_1.normalize)(findComponent(host, pathToCheck)); | ||
} | ||
else { | ||
var componentPath = core_1.normalize('/' + options.path + '/' + options.component); | ||
var componentBaseName = core_1.normalize(componentPath).split('/').pop(); | ||
var componentPath = (0, core_1.normalize)('/' + options.path + '/' + options.component); | ||
var componentBaseName = (0, core_1.normalize)(componentPath).split('/').pop(); | ||
if (host.exists(componentPath)) { | ||
return core_1.normalize(componentPath); | ||
return (0, core_1.normalize)(componentPath); | ||
} | ||
else if (host.exists(componentPath + '.ts')) { | ||
return core_1.normalize(componentPath + '.ts'); | ||
return (0, core_1.normalize)(componentPath + '.ts'); | ||
} | ||
else if (host.exists(componentPath + '.component.ts')) { | ||
return core_1.normalize(componentPath + '.component.ts'); | ||
return (0, core_1.normalize)(componentPath + '.component.ts'); | ||
} | ||
else if (host.exists(componentPath + '/' + componentBaseName + '.component.ts')) { | ||
return core_1.normalize(componentPath + '/' + componentBaseName + '.component.ts'); | ||
return (0, core_1.normalize)(componentPath + '/' + componentBaseName + '.component.ts'); | ||
} | ||
@@ -55,3 +55,3 @@ else { | ||
if (matches.length == 1) { | ||
return core_1.join(dir.path, matches[0]); | ||
return (0, core_1.join)(dir.path, matches[0]); | ||
} | ||
@@ -74,3 +74,3 @@ else if (matches.length > 1) { | ||
var _b = parsePath(to), toPath = _b.path, toFileName = _b.filename, toDirectory = _b.directory; | ||
var relativePath = core_1.relative(fromDirectory, toDirectory); | ||
var relativePath = (0, core_1.relative)(fromDirectory, toDirectory); | ||
var fixedRelativePath = relativePath.startsWith('.') | ||
@@ -87,5 +87,5 @@ ? relativePath | ||
function parsePath(path) { | ||
var pathNormalized = core_1.normalize(path); | ||
var filename = core_1.extname(pathNormalized) ? core_1.basename(pathNormalized) : ''; | ||
var directory = filename ? core_1.dirname(pathNormalized) : pathNormalized; | ||
var pathNormalized = (0, core_1.normalize)(path); | ||
var filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : ''; | ||
var directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized; | ||
return { | ||
@@ -92,0 +92,0 @@ path: pathNormalized, |
@@ -22,18 +22,18 @@ "use strict"; | ||
(options.flat ? '' : '/' + core_1.strings.dasherize(options.name)); | ||
return core_1.normalize(findModule(host, pathToCheck)); | ||
return (0, core_1.normalize)(findModule(host, pathToCheck)); | ||
} | ||
else { | ||
var modulePath = core_1.normalize('/' + options.path + '/' + options.module); | ||
var moduleBaseName = core_1.normalize(modulePath).split('/').pop(); | ||
var modulePath = (0, core_1.normalize)('/' + options.path + '/' + options.module); | ||
var moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop(); | ||
if (host.exists(modulePath)) { | ||
return core_1.normalize(modulePath); | ||
return (0, core_1.normalize)(modulePath); | ||
} | ||
else if (host.exists(modulePath + '.ts')) { | ||
return core_1.normalize(modulePath + '.ts'); | ||
return (0, core_1.normalize)(modulePath + '.ts'); | ||
} | ||
else if (host.exists(modulePath + '.module.ts')) { | ||
return core_1.normalize(modulePath + '.module.ts'); | ||
return (0, core_1.normalize)(modulePath + '.module.ts'); | ||
} | ||
else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { | ||
return core_1.normalize(modulePath + '/' + moduleBaseName + '.module.ts'); | ||
return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '.module.ts'); | ||
} | ||
@@ -56,3 +56,3 @@ else { | ||
if (matches.length == 1) { | ||
return core_1.join(dir.path, matches[0]); | ||
return (0, core_1.join)(dir.path, matches[0]); | ||
} | ||
@@ -75,3 +75,3 @@ else if (matches.length > 1) { | ||
var _b = parsePath(to), toPath = _b.path, toFileName = _b.filename, toDirectory = _b.directory; | ||
var relativePath = core_1.relative(fromDirectory, toDirectory); | ||
var relativePath = (0, core_1.relative)(fromDirectory, toDirectory); | ||
var fixedRelativePath = relativePath.startsWith('.') | ||
@@ -88,5 +88,5 @@ ? relativePath | ||
function parsePath(path) { | ||
var pathNormalized = core_1.normalize(path); | ||
var filename = core_1.extname(pathNormalized) ? core_1.basename(pathNormalized) : ''; | ||
var directory = filename ? core_1.dirname(pathNormalized) : pathNormalized; | ||
var pathNormalized = (0, core_1.normalize)(path); | ||
var filename = (0, core_1.extname)(pathNormalized) ? (0, core_1.basename)(pathNormalized) : ''; | ||
var directory = filename ? (0, core_1.dirname)(pathNormalized) : pathNormalized; | ||
return { | ||
@@ -93,0 +93,0 @@ path: pathNormalized, |
@@ -29,6 +29,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -50,3 +54,3 @@ exports.__esModule = true; | ||
} | ||
var reducersPath = core_1.normalize("/" + options.path + "/" + options.reducers); | ||
var reducersPath = (0, core_1.normalize)("/" + options.path + "/" + options.reducers); | ||
if (!host.exists(reducersPath)) { | ||
@@ -66,4 +70,4 @@ throw new Error("Specified reducers path " + reducersPath + " does not exist"); | ||
'.reducer'; | ||
var relativePath = find_module_1.buildRelativePath(reducersPath, reducerPath); | ||
var reducerImport = ast_utils_1.insertImport(source, reducersPath, "* as from" + stringUtils.classify(options.name), relativePath, true); | ||
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 stateInterfaceInsert = addReducerToStateInterface(source, reducersPath, options); | ||
@@ -199,3 +203,3 @@ var reducerMapInsert = addReducerToActionReducerMap(source, reducersPath, options); | ||
var commonImports = [ | ||
ast_utils_1.insertImport(source, modulePath, 'StoreModule', '@ngrx/store'), | ||
(0, ast_utils_1.insertImport)(source, modulePath, 'StoreModule', '@ngrx/store'), | ||
]; | ||
@@ -207,9 +211,9 @@ var reducerPath = "/" + options.path + "/" + | ||
'.reducer'; | ||
var relativePath = find_module_1.buildRelativePath(modulePath, reducerPath); | ||
var reducerImport = ast_utils_1.insertImport(source, modulePath, "* as from" + stringUtils.classify(options.name), relativePath, true); | ||
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 state = options.plural | ||
? stringUtils.pluralize(options.name) | ||
: stringUtils.camelize(options.name); | ||
var _b = __read(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 changes = __spreadArray(__spreadArray([], __read(commonImports)), [reducerImport, storeNgModuleImport]); | ||
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 changes = __spreadArray(__spreadArray([], __read(commonImports), false), [reducerImport, storeNgModuleImport], false); | ||
var recorder = host.beginUpdate(modulePath); | ||
@@ -216,0 +220,0 @@ try { |
@@ -6,7 +6,7 @@ "use strict"; | ||
function parseName(path, name) { | ||
var nameWithoutPath = core_1.basename(name); | ||
var namePath = core_1.dirname((path + '/' + name)); | ||
var nameWithoutPath = (0, core_1.basename)(name); | ||
var namePath = (0, core_1.dirname)((path + '/' + name)); | ||
return { | ||
name: nameWithoutPath, | ||
path: core_1.normalize('/' + namePath) | ||
path: (0, core_1.normalize)('/' + namePath) | ||
}; | ||
@@ -13,0 +13,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
function getProject(host, options) { | ||
var workspace = config_1.getWorkspace(host); | ||
var workspace = (0, config_1.getWorkspace)(host); | ||
if (!options.project) { | ||
@@ -9,0 +9,0 @@ var defaultProject = workspace |
@@ -99,4 +99,4 @@ "use strict"; | ||
ts.isStringLiteralLike(n.initializer)) { | ||
var parts = core_1.normalize(source.fileName).split('/').slice(0, -1); | ||
var templatePath = core_1.resolve(core_1.normalize(parts.join('/')), core_1.normalize(n.initializer.text)); | ||
var parts = (0, core_1.normalize)(source.fileName).split('/').slice(0, -1); | ||
var templatePath = (0, core_1.resolve)((0, core_1.normalize)(parts.join('/')), (0, core_1.normalize)(n.initializer.text)); | ||
if (!tree.exists(templatePath)) { | ||
@@ -103,0 +103,0 @@ return; |
@@ -18,17 +18,17 @@ "use strict"; | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
options.prefix = schematics_core_1.getPrefix(options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
options.prefix = (0, schematics_core_1.getPrefix)(options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var templateSource = schematics_1.apply(schematics_1.url(options.creators ? './creator-files' : './files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)(options.creators ? './creator-files' : './files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'actions' : ''); | ||
} }), options)), | ||
schematics_1.move(parsedPath.path), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(templateSource)]))])(host, context); | ||
return (0, schematics_1.chain)([(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]))])(host, context); | ||
}; | ||
@@ -35,0 +35,0 @@ } |
@@ -15,3 +15,3 @@ import { | ||
describe('Action Schematic', () => { | ||
xdescribe('Action Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -18,0 +18,0 @@ '@ngrx/schematics', |
@@ -51,3 +51,3 @@ "use strict"; | ||
'.store'; | ||
var componentStoreRelativePath = schematics_core_1.buildRelativePath(providingPath, componentStorePath); | ||
var componentStoreRelativePath = (0, schematics_core_1.buildRelativePath)(providingPath, componentStorePath); | ||
return { | ||
@@ -78,4 +78,4 @@ componentStoreRelativePath: componentStoreRelativePath, | ||
var context = createProvidingContext(options, options.module); | ||
var componentStore = schematics_core_1.insertImport(source, modulePath, context.componentStoreName, context.componentStoreRelativePath); | ||
var _b = __read(schematics_core_1.addProviderToModule(source, modulePath, context.componentStoreName, context.componentStoreRelativePath), 1), storeNgModuleProvider = _b[0]; | ||
var componentStore = (0, schematics_core_1.insertImport)(source, modulePath, context.componentStoreName, context.componentStoreRelativePath); | ||
var _b = __read((0, schematics_core_1.addProviderToModule)(source, modulePath, context.componentStoreName, context.componentStoreRelativePath), 1), storeNgModuleProvider = _b[0]; | ||
var changes = [componentStore, storeNgModuleProvider]; | ||
@@ -123,4 +123,4 @@ var recorder = host.beginUpdate(modulePath); | ||
var context = createProvidingContext(options, options.component); | ||
var componentStore = schematics_core_1.insertImport(source, componentPath, context.componentStoreName, context.componentStoreRelativePath); | ||
var _b = __read(schematics_core_1.addProviderToComponent(source, componentPath, context.componentStoreName, context.componentStoreRelativePath), 1), storeNgModuleProvider = _b[0]; | ||
var componentStore = (0, schematics_core_1.insertImport)(source, componentPath, context.componentStoreName, context.componentStoreRelativePath); | ||
var _b = __read((0, schematics_core_1.addProviderToComponent)(source, componentPath, context.componentStoreName, context.componentStoreRelativePath), 1), storeNgModuleProvider = _b[0]; | ||
var changes = [componentStore, storeNgModuleProvider]; | ||
@@ -150,24 +150,24 @@ var recorder = host.beginUpdate(componentPath); | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
if (options.module) { | ||
options.module = schematics_core_1.findModuleFromOptions(host, options); | ||
options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); | ||
} | ||
if (options.component) { | ||
options.component = schematics_core_1.findComponentFromOptions(host, options); | ||
options.component = (0, schematics_core_1.findComponentFromOptions)(host, options); | ||
} | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var templateSource = schematics_1.apply(schematics_1.url('./files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { return (options.flat ? '' : s); } }), options)), | ||
schematics_1.move(parsedPath.path), | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { return (options.flat ? '' : s); } }), options)), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([ | ||
schematics_1.branchAndMerge(schematics_1.chain([ | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([ | ||
addComponentStoreProviderToNgModule(options), | ||
addComponentStoreProviderToComponent(options), | ||
schematics_1.mergeWith(templateSource), | ||
(0, schematics_1.mergeWith)(templateSource), | ||
])), | ||
@@ -174,0 +174,0 @@ ])(host, context); |
@@ -14,3 +14,3 @@ import { | ||
describe('component-store', () => { | ||
xdescribe('component-store', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -106,3 +106,3 @@ '@ngrx/schematics', | ||
); | ||
} catch (err) { | ||
} catch (err: any) { | ||
thrownError = err; | ||
@@ -162,3 +162,3 @@ } | ||
); | ||
} catch (err) { | ||
} catch (err: any) { | ||
thrownError = err; | ||
@@ -165,0 +165,0 @@ } |
@@ -66,6 +66,6 @@ "use strict"; | ||
var source = ts.createSourceFile(componentPath, sourceText, ts.ScriptTarget.Latest, true); | ||
var stateImportPath = schematics_core_1.buildRelativePath(componentPath, statePath); | ||
var storeImport = schematics_core_1.insertImport(source, componentPath, 'Store', '@ngrx/store'); | ||
var stateImportPath = (0, schematics_core_1.buildRelativePath)(componentPath, statePath); | ||
var storeImport = (0, schematics_core_1.insertImport)(source, componentPath, 'Store', '@ngrx/store'); | ||
var stateImport = options.state | ||
? schematics_core_1.insertImport(source, componentPath, "* as fromStore", stateImportPath, true) | ||
? (0, schematics_core_1.insertImport)(source, componentPath, "* as fromStore", stateImportPath, true) | ||
: new schematics_core_1.NoopChange(); | ||
@@ -108,15 +108,15 @@ var componentClass = source.statements.find(function (stm) { return stm.kind === ts.SyntaxKind.ClassDeclaration; }); | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var opts = ['state', 'stateInterface', 'testDepth'].reduce(function (current, key) { | ||
return schematics_core_1.omit(current, key); | ||
return (0, schematics_core_1.omit)(current, key); | ||
}, options); | ||
var templateSource = schematics_1.apply(schematics_1.url(options.testDepth === 'unit' ? './files' : './integration-files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)(options.testDepth === 'unit' ? './files' : './integration-files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign({ 'if-flat': function (s) { return (options.flat ? '' : s); } }, schematics_core_1.stringUtils), options)), | ||
schematics_1.move(parsedPath.path), | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign({ 'if-flat': function (s) { return (options.flat ? '' : s); } }, schematics_core_1.stringUtils), options)), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
@@ -127,6 +127,6 @@ // Remove all undefined values to use the schematic defaults (in angular.json or the Angular schema) | ||
}); | ||
return schematics_1.chain([ | ||
schematics_1.externalSchematic('@schematics/angular', 'component', __assign(__assign({}, opts), { skipTests: true })), | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.externalSchematic)('@schematics/angular', 'component', __assign(__assign({}, opts), { skipTests: true })), | ||
addStateToComponent(options), | ||
schematics_1.mergeWith(templateSource), | ||
(0, schematics_1.mergeWith)(templateSource), | ||
])(host, context); | ||
@@ -133,0 +133,0 @@ }; |
@@ -12,3 +12,3 @@ import { | ||
describe('Container Schematic', () => { | ||
xdescribe('Container Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -15,0 +15,0 @@ '@ngrx/schematics', |
@@ -18,16 +18,16 @@ "use strict"; | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var templateSource = schematics_1.apply(schematics_1.url('./files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'data' : ''); | ||
} }), options)), | ||
schematics_1.move(parsedPath.path), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(templateSource)]))])(host, context); | ||
return (0, schematics_1.chain)([(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]))])(host, context); | ||
}; | ||
@@ -34,0 +34,0 @@ } |
@@ -14,3 +14,3 @@ import { | ||
describe('Data Schematic', () => { | ||
xdescribe('Data Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -17,0 +17,0 @@ '@ngrx/schematics', |
@@ -61,3 +61,3 @@ "use strict"; | ||
var effectsName = "" + schematics_core_1.stringUtils.classify(options.name + "Effects"); | ||
var effectsModuleImport = schematics_core_1.insertImport(source, modulePath, 'EffectsModule', '@ngrx/effects'); | ||
var effectsModuleImport = (0, schematics_core_1.insertImport)(source, modulePath, 'EffectsModule', '@ngrx/effects'); | ||
var effectsPath = "/" + options.path + "/" + | ||
@@ -68,6 +68,6 @@ (options.flat ? '' : schematics_core_1.stringUtils.dasherize(options.name) + '/') + | ||
'.effects'; | ||
var relativePath = schematics_core_1.buildRelativePath(modulePath, effectsPath); | ||
var effectsImport = schematics_core_1.insertImport(source, modulePath, effectsName, relativePath); | ||
var relativePath = (0, schematics_core_1.buildRelativePath)(modulePath, effectsPath); | ||
var effectsImport = (0, schematics_core_1.insertImport)(source, modulePath, effectsName, relativePath); | ||
var effectsSetup = options.root && options.minimal ? "[]" : "[" + effectsName + "]"; | ||
var _b = __read(schematics_core_1.addImportToModule(source, modulePath, "EffectsModule.for" + (options.root ? 'Root' : 'Feature') + "(" + effectsSetup + ")", relativePath), 1), effectsNgModuleImport = _b[0]; | ||
var _b = __read((0, schematics_core_1.addImportToModule)(source, modulePath, "EffectsModule.for" + (options.root ? 'Root' : 'Feature') + "(" + effectsSetup + ")", relativePath), 1), effectsNgModuleImport = _b[0]; | ||
var changes = [effectsModuleImport, effectsNgModuleImport]; | ||
@@ -114,22 +114,22 @@ if (!options.root || (options.root && !options.minimal)) { | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
options.prefix = schematics_core_1.getPrefix(options); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
options.prefix = (0, schematics_core_1.getPrefix)(options); | ||
if (options.module) { | ||
options.module = schematics_core_1.findModuleFromOptions(host, options); | ||
options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); | ||
} | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name || ''); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name || ''); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var templateSource = schematics_1.apply(schematics_1.url('./files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
options.root && options.minimal ? schematics_1.filter(function (_) { return false; }) : schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
options.root && options.minimal ? (0, schematics_1.filter)(function (_) { return false; }) : (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
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)), | ||
schematics_1.move(parsedPath.path), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([ | ||
schematics_1.branchAndMerge(schematics_1.chain([addImportToNgModule(options), schematics_1.mergeWith(templateSource)])), | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([addImportToNgModule(options), (0, schematics_1.mergeWith)(templateSource)])), | ||
])(host, context); | ||
@@ -136,0 +136,0 @@ }; |
@@ -15,3 +15,3 @@ import { | ||
describe('Effect Schematic', () => { | ||
xdescribe('Effect Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -110,3 +110,3 @@ '@ngrx/schematics', | ||
await schematicRunner.runSchematicAsync('effects', options, appTree); | ||
} catch (err) { | ||
} catch (err: any) { | ||
thrownError = err; | ||
@@ -113,0 +113,0 @@ } |
@@ -18,9 +18,9 @@ "use strict"; | ||
return function (host, context) { | ||
var projectConfig = schematics_core_1.getProject(host, options); | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
var projectConfig = (0, schematics_core_1.getProject)(host, options); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
if (options.module) { | ||
options.module = schematics_core_1.findModuleFromOptions(host, options); | ||
options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); | ||
} | ||
@@ -33,16 +33,16 @@ var templateOptions = __assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { return (options.flat ? '' : s); }, 'group-actions': function (name) { | ||
return schematics_core_1.stringUtils.group(s, options.group ? 'reducers' : ''); | ||
}, isIvyEnabled: schematics_core_1.isIvyEnabled(host, 'tsconfig.json') && | ||
schematics_core_1.isIvyEnabled(host, projectConfig.root + "/tsconfig.app.json") }), options); | ||
var commonTemplates = schematics_1.apply(schematics_1.url('./common-files'), [ | ||
}, isIvyEnabled: (0, schematics_core_1.isIvyEnabled)(host, 'tsconfig.json') && | ||
(0, schematics_core_1.isIvyEnabled)(host, projectConfig.root + "/tsconfig.app.json") }), options); | ||
var commonTemplates = (0, schematics_1.apply)((0, schematics_1.url)('./common-files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(templateOptions), | ||
schematics_1.move(parsedPath.path), | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(templateOptions), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
var templateSource = schematics_1.apply(schematics_1.url(options.creators ? './creator-files' : './files'), [schematics_1.applyTemplates(templateOptions), schematics_1.move(parsedPath.path)]); | ||
return schematics_1.chain([ | ||
schematics_core_1.addReducerToState(__assign(__assign({}, options), { plural: true })), | ||
schematics_core_1.addReducerImportToNgModule(__assign(__assign({}, options), { plural: true })), | ||
schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(commonTemplates), schematics_1.mergeWith(templateSource)])), | ||
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)])), | ||
])(host, context); | ||
@@ -49,0 +49,0 @@ }; |
@@ -14,3 +14,3 @@ import { | ||
describe('Entity Schematic', () => { | ||
xdescribe('Entity Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -17,0 +17,0 @@ '@ngrx/schematics', |
@@ -6,4 +6,4 @@ "use strict"; | ||
return function (host, context) { | ||
return schematics_1.chain([ | ||
schematics_1.schematic('action', { | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.schematic)('action', { | ||
flat: options.flat, | ||
@@ -19,3 +19,3 @@ group: options.group, | ||
}), | ||
schematics_1.schematic('reducer', { | ||
(0, schematics_1.schematic)('reducer', { | ||
flat: options.flat, | ||
@@ -34,3 +34,3 @@ group: options.group, | ||
}), | ||
schematics_1.schematic('effect', { | ||
(0, schematics_1.schematic)('effect', { | ||
flat: options.flat, | ||
@@ -48,3 +48,3 @@ group: options.group, | ||
}), | ||
schematics_1.schematic('selector', { | ||
(0, schematics_1.schematic)('selector', { | ||
flat: options.flat, | ||
@@ -51,0 +51,0 @@ group: options.group, |
@@ -14,3 +14,3 @@ import { | ||
describe('Feature Schematic', () => { | ||
xdescribe('Feature Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -17,0 +17,0 @@ '@ngrx/schematics', |
@@ -17,4 +17,4 @@ "use strict"; | ||
function updateWorkspaceCli(host, value) { | ||
var workspace = schematics_core_1.getWorkspace(host); | ||
var path = schematics_core_1.getWorkspacePath(host); | ||
var workspace = (0, schematics_core_1.getWorkspace)(host); | ||
var path = (0, schematics_core_1.getWorkspacePath)(host); | ||
workspace['cli'] = __assign(__assign({}, workspace['cli']), value); | ||
@@ -34,4 +34,4 @@ host.overwrite(path, JSON.stringify(workspace, null, 2)); | ||
return function (host, context) { | ||
return schematics_1.chain([ | ||
options && options.defaultCollection ? setAsDefaultSchematics() : schematics_1.noop(), | ||
return (0, schematics_1.chain)([ | ||
options && options.defaultCollection ? setAsDefaultSchematics() : (0, schematics_1.noop)(), | ||
])(host, context); | ||
@@ -38,0 +38,0 @@ }; |
@@ -9,3 +9,3 @@ import { | ||
describe('ng-add Schematic', () => { | ||
xdescribe('ng-add Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -12,0 +12,0 @@ '@ngrx/schematics', |
@@ -19,3 +19,3 @@ "use strict"; | ||
return function (host) { | ||
return schematics_core_1.visitTemplates(host, function (template) { | ||
return (0, schematics_core_1.visitTemplates)(host, function (template) { | ||
var match; | ||
@@ -29,3 +29,3 @@ var changes = []; | ||
} | ||
return schematics_core_1.commitChanges(host, template.fileName, changes); | ||
return (0, schematics_core_1.commitChanges)(host, template.fileName, changes); | ||
}); | ||
@@ -37,6 +37,6 @@ }; | ||
return function (host) { | ||
schematics_core_1.visitTSSourceFiles(host, function (sourceFile) { | ||
(0, schematics_core_1.visitTSSourceFiles)(host, function (sourceFile) { | ||
var hasCommonModuleOrBrowserModule = false; | ||
var hasReactiveComponentModule = false; | ||
schematics_core_1.visitNgModuleImports(sourceFile, function (_, importNodes) { | ||
(0, schematics_core_1.visitNgModuleImports)(sourceFile, function (_, importNodes) { | ||
hasCommonModuleOrBrowserModule = importNodes.some(ngModulesToFind); | ||
@@ -46,4 +46,4 @@ hasReactiveComponentModule = importNodes.some(reactiveModuleToFind); | ||
if (hasCommonModuleOrBrowserModule && !hasReactiveComponentModule) { | ||
var changes = schematics_core_1.addImportToModule(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
schematics_core_1.commitChanges(host, sourceFile.fileName, changes); | ||
var changes = (0, schematics_core_1.addImportToModule)(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
(0, schematics_core_1.commitChanges)(host, sourceFile.fileName, changes); | ||
} | ||
@@ -56,6 +56,6 @@ }); | ||
return function (host) { | ||
schematics_core_1.visitTSSourceFiles(host, function (sourceFile) { | ||
(0, schematics_core_1.visitTSSourceFiles)(host, function (sourceFile) { | ||
var hasCommonModuleOrBrowserModule = false; | ||
var hasReactiveComponentModule = false; | ||
schematics_core_1.visitNgModuleExports(sourceFile, function (_, exportNodes) { | ||
(0, schematics_core_1.visitNgModuleExports)(sourceFile, function (_, exportNodes) { | ||
hasCommonModuleOrBrowserModule = exportNodes.some(ngModulesToFind); | ||
@@ -65,4 +65,4 @@ hasReactiveComponentModule = exportNodes.some(reactiveModuleToFind); | ||
if (hasCommonModuleOrBrowserModule && !hasReactiveComponentModule) { | ||
var changes = schematics_core_1.addExportToModule(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
schematics_core_1.commitChanges(host, sourceFile.fileName, changes); | ||
var changes = (0, schematics_core_1.addExportToModule)(sourceFile, sourceFile.fileName, REACTIVE_MODULE, COMPONENT_MODULE); | ||
(0, schematics_core_1.commitChanges)(host, sourceFile.fileName, changes); | ||
} | ||
@@ -74,3 +74,3 @@ }); | ||
function default_1() { | ||
return schematics_1.chain([ | ||
return (0, schematics_1.chain)([ | ||
migrateToNgrxPush(), | ||
@@ -77,0 +77,0 @@ importReactiveComponentModule(), |
@@ -8,3 +8,3 @@ import { | ||
describe('NgrxPush migration', () => { | ||
xdescribe('NgrxPush migration', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -11,0 +11,0 @@ '@ngrx/schematics', |
@@ -18,9 +18,9 @@ "use strict"; | ||
return function (host, context) { | ||
var projectConfig = schematics_core_1.getProject(host, options); | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
options.prefix = schematics_core_1.getPrefix(options); | ||
var projectConfig = (0, schematics_core_1.getProject)(host, options); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
options.prefix = (0, schematics_core_1.getPrefix)(options); | ||
if (options.module) { | ||
options.module = schematics_core_1.findModuleFromOptions(host, options); | ||
options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); | ||
} | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name); | ||
options.name = parsedPath.name; | ||
@@ -30,18 +30,18 @@ options.path = parsedPath.path; | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'reducers' : ''); | ||
}, isIvyEnabled: schematics_core_1.isIvyEnabled(host, 'tsconfig.json') && | ||
schematics_core_1.isIvyEnabled(host, projectConfig.root + "/tsconfig.app.json") }), options); | ||
var commonTemplate = schematics_1.apply(schematics_1.url('./common-files'), [ | ||
}, isIvyEnabled: (0, schematics_core_1.isIvyEnabled)(host, 'tsconfig.json') && | ||
(0, schematics_core_1.isIvyEnabled)(host, projectConfig.root + "/tsconfig.app.json") }), options); | ||
var commonTemplate = (0, schematics_1.apply)((0, schematics_1.url)('./common-files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(templateOptions), | ||
schematics_1.move(parsedPath.path), | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(templateOptions), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
var templateSource = schematics_1.apply(schematics_1.url(options.creators ? './creator-files' : './files'), [schematics_1.applyTemplates(templateOptions), schematics_1.move(parsedPath.path)]); | ||
return schematics_1.chain([ | ||
schematics_1.branchAndMerge(schematics_1.chain([schematics_core_1.addReducerToState(options)])), | ||
schematics_1.branchAndMerge(schematics_1.chain([ | ||
schematics_core_1.addReducerImportToNgModule(options), | ||
schematics_1.mergeWith(commonTemplate), | ||
schematics_1.mergeWith(templateSource), | ||
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), | ||
])), | ||
@@ -48,0 +48,0 @@ ])(host, context); |
@@ -15,3 +15,3 @@ import { | ||
describe('Reducer Schematic', () => { | ||
xdescribe('Reducer Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -18,0 +18,0 @@ '@ngrx/schematics', |
@@ -18,16 +18,16 @@ "use strict"; | ||
return function (host, context) { | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name || ''); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name || ''); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var templateSource = schematics_1.apply(schematics_1.url('./files'), [ | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.skipTests | ||
? schematics_1.filter(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
? (0, schematics_1.filter)(function (path) { return !path.endsWith('.spec.ts.template'); }) | ||
: (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), { 'if-flat': function (s) { | ||
return schematics_core_1.stringUtils.group(options.flat ? '' : s, options.group ? 'selectors' : ''); | ||
}, reducerPath: "" + relativePath(options) + schematics_core_1.stringUtils.dasherize(options.name) + ".reducer" }), options)), | ||
schematics_1.move(parsedPath.path), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([schematics_1.branchAndMerge(schematics_1.chain([schematics_1.mergeWith(templateSource)]))])(host, context); | ||
return (0, schematics_1.chain)([(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]))])(host, context); | ||
}; | ||
@@ -34,0 +34,0 @@ } |
@@ -13,3 +13,3 @@ import { tags } from '@angular-devkit/core'; | ||
describe('Selector Schematic', () => { | ||
xdescribe('Selector Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -16,0 +16,0 @@ '@ngrx/schematics', |
@@ -29,6 +29,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -68,11 +72,11 @@ var __values = (this && this.__values) || function(o) { | ||
var statePath = options.path + "/" + options.statePath; | ||
var relativePath = schematics_core_1.buildRelativePath(modulePath, statePath); | ||
var environmentsPath = schematics_core_1.buildRelativePath(statePath, options.path + "/environments/environment"); | ||
var relativePath = (0, schematics_core_1.buildRelativePath)(modulePath, statePath); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, options.path + "/environments/environment"); | ||
var rootStoreReducers = options.minimal ? "{}" : "reducers"; | ||
var rootStoreConfig = options.minimal ? "" : ", { metaReducers }"; | ||
var storeNgModuleImport = schematics_core_1.addImportToModule(source, modulePath, options.root | ||
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(); | ||
var commonImports = [ | ||
schematics_core_1.insertImport(source, modulePath, 'StoreModule', '@ngrx/store'), | ||
(0, schematics_core_1.insertImport)(source, modulePath, 'StoreModule', '@ngrx/store'), | ||
storeNgModuleImport, | ||
@@ -82,3 +86,3 @@ ]; | ||
commonImports = commonImports.concat([ | ||
schematics_core_1.insertImport(source, modulePath, 'reducers, metaReducers', relativePath), | ||
(0, schematics_core_1.insertImport)(source, modulePath, 'reducers, metaReducers', relativePath), | ||
]); | ||
@@ -88,3 +92,3 @@ } | ||
commonImports = commonImports.concat([ | ||
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" + schematics_core_1.stringUtils.classify(options.name), relativePath, true), | ||
]); | ||
@@ -95,3 +99,3 @@ } | ||
var hasImports_1 = false; | ||
schematics_core_1.visitNgModuleImports(source, function (_, importNodes) { | ||
(0, schematics_core_1.visitNgModuleImports)(source, function (_, importNodes) { | ||
hasImports_1 = importNodes.length > 0; | ||
@@ -103,10 +107,10 @@ }); | ||
var adjectiveComma = hasImports_1 ? '' : ', '; | ||
var storeDevtoolsNgModuleImport = schematics_core_1.addImportToModule(source, modulePath, adjectiveComma + "!environment.production ? StoreDevtoolsModule.instrument() : []", relativePath).shift(); | ||
var storeDevtoolsNgModuleImport = (0, schematics_core_1.addImportToModule)(source, modulePath, adjectiveComma + "!environment.production ? StoreDevtoolsModule.instrument() : []", relativePath).shift(); | ||
rootImports = rootImports.concat([ | ||
schematics_core_1.insertImport(source, modulePath, 'StoreDevtoolsModule', '@ngrx/store-devtools'), | ||
schematics_core_1.insertImport(source, modulePath, 'environment', environmentsPath), | ||
(0, schematics_core_1.insertImport)(source, modulePath, 'StoreDevtoolsModule', '@ngrx/store-devtools'), | ||
(0, schematics_core_1.insertImport)(source, modulePath, 'environment', environmentsPath), | ||
storeDevtoolsNgModuleImport, | ||
]); | ||
} | ||
var changes = __spreadArray(__spreadArray([], __read(commonImports)), __read(rootImports)); | ||
var changes = __spreadArray(__spreadArray([], __read(commonImports), false), __read(rootImports), false); | ||
var recorder = host.beginUpdate(modulePath); | ||
@@ -137,11 +141,11 @@ try { | ||
} | ||
options.path = schematics_core_1.getProjectPath(host, options); | ||
var parsedPath = schematics_core_1.parseName(options.path, options.name || ''); | ||
options.path = (0, schematics_core_1.getProjectPath)(host, options); | ||
var parsedPath = (0, schematics_core_1.parseName)(options.path, options.name || ''); | ||
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
var statePath = "/" + options.path + "/" + options.statePath + "/index.ts"; | ||
var srcPath = core_1.dirname(options.path); | ||
var environmentsPath = schematics_core_1.buildRelativePath(statePath, srcPath + "/environments/environment"); | ||
var srcPath = (0, core_1.dirname)(options.path); | ||
var environmentsPath = (0, schematics_core_1.buildRelativePath)(statePath, srcPath + "/environments/environment"); | ||
if (options.module) { | ||
options.module = schematics_core_1.findModuleFromOptions(host, options); | ||
options.module = (0, schematics_core_1.findModuleFromOptions)(host, options); | ||
} | ||
@@ -153,9 +157,9 @@ if (options.root && | ||
} | ||
var templateSource = schematics_1.apply(schematics_1.url('./files'), [ | ||
options.root && options.minimal ? schematics_1.filter(function (_) { return false; }) : schematics_1.noop(), | ||
schematics_1.applyTemplates(__assign(__assign(__assign({}, schematics_core_1.stringUtils), options), { isLib: schematics_core_1.isLib(host, options), environmentsPath: environmentsPath })), | ||
schematics_1.move(parsedPath.path), | ||
var templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [ | ||
options.root && options.minimal ? (0, schematics_1.filter)(function (_) { return false; }) : (0, schematics_1.noop)(), | ||
(0, schematics_1.applyTemplates)(__assign(__assign(__assign({}, schematics_core_1.stringUtils), options), { isLib: (0, schematics_core_1.isLib)(host, options), environmentsPath: environmentsPath })), | ||
(0, schematics_1.move)(parsedPath.path), | ||
]); | ||
return schematics_1.chain([ | ||
schematics_1.branchAndMerge(schematics_1.chain([addImportToNgModule(options), schematics_1.mergeWith(templateSource)])), | ||
return (0, schematics_1.chain)([ | ||
(0, schematics_1.branchAndMerge)((0, schematics_1.chain)([addImportToNgModule(options), (0, schematics_1.mergeWith)(templateSource)])), | ||
])(host, context); | ||
@@ -162,0 +166,0 @@ }; |
@@ -14,3 +14,3 @@ import { | ||
describe('Store Schematic', () => { | ||
xdescribe('Store Schematic', () => { | ||
const schematicRunner = new SchematicTestRunner( | ||
@@ -203,3 +203,3 @@ '@ngrx/schematics', | ||
await schematicRunner.runSchematicAsync('store', options, appTree); | ||
} catch (err) { | ||
} catch (err: any) { | ||
thrownError = err; | ||
@@ -206,0 +206,0 @@ } |
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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
496654
151
1
100
6679