@ngx-pwa/local-storage
Advanced tools
Comparing version 9.0.1 to 9.0.2
{ | ||
"name": "@ngx-pwa/local-storage", | ||
"version": "9.0.1", | ||
"version": "9.0.2", | ||
"funding": { | ||
@@ -5,0 +5,0 @@ "type": "github", |
@@ -9,7 +9,2 @@ { | ||
}, | ||
"migration-v9-beta": { | ||
"version": "9.0.0-beta", | ||
"description": "Updates @ngx-pwa/local-storage to v9", | ||
"factory": "./ng-update/index#updateToV9" | ||
}, | ||
"migration-v9": { | ||
@@ -16,0 +11,0 @@ "version": "9", |
@@ -18,6 +18,5 @@ "use strict"; | ||
/* Get config */ | ||
const libMajorVersion = config_1.getLibMajorVersion(host); | ||
const mainPaths = yield config_1.getAllMainPaths(host); | ||
/* Update `AppModule` of all projects */ | ||
return schematics_1.chain(mainPaths.map((mainPath) => module_1.updateModule(libMajorVersion, mainPath))); | ||
return schematics_1.chain(mainPaths.map((mainPath) => module_1.updateModule(mainPath))); | ||
}); | ||
@@ -29,6 +28,5 @@ } | ||
/* Get config */ | ||
const libMajorVersion = config_1.getLibMajorVersion(host); | ||
const mainPaths = yield config_1.getAllMainPaths(host); | ||
/* Update `AppModule` of all projects */ | ||
return schematics_1.chain(mainPaths.map((mainPath) => module_1.updateModule(libMajorVersion, mainPath))); | ||
return schematics_1.chain(mainPaths.map((mainPath) => module_1.updateModule(mainPath))); | ||
}); | ||
@@ -35,0 +33,0 @@ } |
import { Tree } from '@angular-devkit/schematics'; | ||
export declare const packageName = "@ngx-pwa/local-storage"; | ||
export declare const packageVersionLatest = "^9.0.1"; | ||
export declare const packageVersionLatest = "^9.0.2"; | ||
export declare const packageVersionLTS8 = "^8.2.4"; | ||
export declare const packageVersionLTS7 = "^6.2.5"; | ||
export declare function getAngularMajorVersion(host: Tree): number; | ||
export declare function getLibMajorVersion(host: Tree): number; | ||
export declare function getAllMainPaths(host: Tree): Promise<string[]>; | ||
export declare function getMainPath(host: Tree, userProject?: string): Promise<string>; |
@@ -18,8 +18,5 @@ "use strict"; | ||
// TODO: Automate this | ||
exports.packageVersionLatest = '^9.0.1'; | ||
exports.packageVersionLatest = '^9.0.2'; | ||
exports.packageVersionLTS8 = '^8.2.4'; | ||
exports.packageVersionLTS7 = '^6.2.5'; | ||
function getMajorVersion(version) { | ||
return Number.parseInt(version.replace('~', '').replace('^', '').substr(0, 1), 10); | ||
} | ||
function getAngularMajorVersion(host) { | ||
@@ -31,14 +28,6 @@ const angularDependency = dependencies_1.getPackageJsonDependency(host, '@angular/core'); | ||
} | ||
return getMajorVersion(angularDependency.version); | ||
/* Remove semver signs if present and keep only the first number (major) */ | ||
return Number.parseInt(angularDependency.version.replace('~', '').replace('^', '').substr(0, 1), 10); | ||
} | ||
exports.getAngularMajorVersion = getAngularMajorVersion; | ||
function getLibMajorVersion(host) { | ||
const libDependency = dependencies_1.getPackageJsonDependency(host, exports.packageName); | ||
/* Throw if Angular is not installed */ | ||
if (libDependency === null) { | ||
throw new schematics_1.SchematicsException(`${exports.packageName} is required to update it`); | ||
} | ||
return getMajorVersion(libDependency.version); | ||
} | ||
exports.getLibMajorVersion = getLibMajorVersion; | ||
function getAllMainPaths(host) { | ||
@@ -45,0 +34,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -9,3 +9,3 @@ import { Rule } from '@angular-devkit/schematics'; | ||
*/ | ||
export declare function updateModule(libMajorVersion: number, mainPath: string): Rule; | ||
export declare function updateModule(mainPath: string): Rule; | ||
/** | ||
@@ -12,0 +12,0 @@ * @param mainPath Path of the project `main.ts` file |
@@ -53,8 +53,7 @@ "use strict"; | ||
*/ | ||
function updateModule(libMajorVersion, mainPath) { | ||
function updateModule(mainPath) { | ||
return (host) => { | ||
const { appModulePath, appModuleFile } = getAppModule(host, mainPath); | ||
/* If `IDBNoWrap` is already set, it **must not** be changed, otherwise previously stored data would be lost. | ||
* Also, projects already updated to v9 don't need migration */ | ||
if (!appModuleFile.includes('IDBNoWrap') && libMajorVersion < 9) { | ||
/* If `IDBNoWrap` is already set, it **must not** be changed, otherwise previously stored data would be lost */ | ||
if (!appModuleFile.includes('IDBNoWrap')) { | ||
if (appModuleFile.includes(config_1.packageName)) { | ||
@@ -61,0 +60,0 @@ /* It's important to keep the current options, otherwise previously stored data would be lost */ |
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
1054752
8842