Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mergeMap(({version, depName, depVersion, npmPackageJson}) => {
const updateVersion = _getVersionFromNpmPackage(npmPackageJson, version, loose);
const npmPackageVersions = Object.keys(npmPackageJson['versions'] as JsonObject);
const match = semver.maxSatisfying(npmPackageVersions, updateVersion);
if (!match) {
return EMPTY;
}
if (semver.lt(
semverIntersect.parseRange(updateVersion).version,
semverIntersect.parseRange(depVersion).version)
) {
throw new SchematicsException(`Cannot downgrade package ${
JSON.stringify(depName)} from version "${depVersion}" to "${updateVersion}".`,
);
}
const innerNpmPackageJson = (npmPackageJson['versions'] as JsonObject)[match] as JsonObject;
const dependencies: { [name: string]: string } = {};
const deps = innerNpmPackageJson['peerDependencies'] as JsonObject;
if (deps) {
for (const depName of Object.keys(deps)) {
dependencies[depName] = deps[depName] as string;
}
}
mergeMap(({version, depName, depVersion, npmPackageJson}) => {
const updateVersion = _getVersionFromNpmPackage(npmPackageJson, version, loose);
const npmPackageVersions = Object.keys(npmPackageJson['versions'] as JsonObject);
const match = semver.maxSatisfying(npmPackageVersions, updateVersion);
if (!match) {
return EMPTY;
}
if (semver.lt(
semverIntersect.parseRange(updateVersion).version,
semverIntersect.parseRange(depVersion).version)
) {
throw new SchematicsException(`Cannot downgrade package ${
JSON.stringify(depName)} from version "${depVersion}" to "${updateVersion}".`,
);
}
const innerNpmPackageJson = (npmPackageJson['versions'] as JsonObject)[match] as JsonObject;
const dependencies: { [name: string]: string } = {};
const deps = innerNpmPackageJson['peerDependencies'] as JsonObject;
if (deps) {
for (const depName of Object.keys(deps)) {
dependencies[depName] = deps[depName] as string;
}
}