@ngrx/component-store
Advanced tools
Comparing version
@@ -35,3 +35,2 @@ "use strict"; | ||
return function (tree, ctx) { | ||
var changes = []; | ||
(0, schematics_core_1.addPackageToPackageJson)(tree, 'dependencies', '@ngrx/operators', '^18.0.0'); | ||
@@ -42,7 +41,10 @@ (0, schematics_core_1.visitTSSourceFiles)(tree, function (sourceFile) { | ||
getImportDeclarations(sourceFile, importDeclarations); | ||
var componentStoreImportsAndDeclaration = importDeclarations | ||
var componentStoreImportsAndDeclarations = importDeclarations | ||
.map(function (componentStoreImportDeclaration) { | ||
var componentStoreImports = getComponentStoreNamedBinding(componentStoreImportDeclaration); | ||
if (componentStoreImports) { | ||
return { componentStoreImports: componentStoreImports, componentStoreImportDeclaration: componentStoreImportDeclaration }; | ||
if (componentStoreImports.elements.some(function (element) { return element.name.getText() === 'tapResponse'; })) { | ||
return { componentStoreImports: componentStoreImports, componentStoreImportDeclaration: componentStoreImportDeclaration }; | ||
} | ||
return undefined; | ||
} | ||
@@ -53,3 +55,11 @@ else { | ||
}) | ||
.find(Boolean); | ||
.filter(Boolean); | ||
if (componentStoreImportsAndDeclarations.length === 0) { | ||
return; | ||
} | ||
else if (componentStoreImportsAndDeclarations.length > 1) { | ||
ctx.logger.info('[@ngrx/component-store] Skipping because of multiple `tapResponse` imports'); | ||
return; | ||
} | ||
var _b = __read(componentStoreImportsAndDeclarations, 1), componentStoreImportsAndDeclaration = _b[0]; | ||
if (!componentStoreImportsAndDeclaration) { | ||
@@ -66,2 +76,3 @@ return; | ||
.join(', '); | ||
var changes = []; | ||
// Remove `tapResponse` from @ngrx/component-store and leave the other imports | ||
@@ -91,3 +102,4 @@ if (otherComponentStoreImports) { | ||
var newOperatorsImport = "import { tapResponse } from '@ngrx/operators';"; | ||
changes.push(new schematics_core_1.InsertChange(sourceFile.fileName, componentStoreImportDeclaration.getEnd() + 1, "".concat(newOperatorsImport, "\n"))); | ||
changes.push(new schematics_core_1.InsertChange(sourceFile.fileName, componentStoreImportDeclaration.getEnd() + 1, "".concat(newOperatorsImport, "\n") // not os-independent for snapshot tests | ||
)); | ||
} | ||
@@ -94,0 +106,0 @@ (0, schematics_core_1.commitChanges)(tree, sourceFile.fileName, changes); |
{ | ||
"name": "@ngrx/component-store", | ||
"version": "18.0.0", | ||
"version": "18.0.1", | ||
"description": "Reactive store for component state", | ||
@@ -47,3 +47,3 @@ "repository": { | ||
"dependencies": { | ||
"@ngrx/operators": "17.0.0-beta.0", | ||
"@ngrx/operators": "18.0.1", | ||
"tslib": "^2.0.0" | ||
@@ -50,0 +50,0 @@ }, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.platformVersion = void 0; | ||
exports.platformVersion = '^18.0.0'; | ||
exports.platformVersion = '^18.0.1'; | ||
//# sourceMappingURL=libs-version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
355020
0.51%3210
0.38%+ Added
- Removed
Updated