@auto/bump
Advanced tools
Comparing version
@@ -1,3 +0,3 @@ | ||
import { TWorkspacesGitBump, TWorkspacesPackageBump, TPackages, TWorkspacesOptions } from '@auto/utils'; | ||
import { TPackages, TWorkspacesGitBump, TWorkspacesOptions, TWorkspacesPackageBump } from '@auto/utils'; | ||
import { TBumpOptions } from './types'; | ||
export declare const getWorkspacesPackagesBumps: (packages: TPackages, bumps: TWorkspacesGitBump[], bumpOptions: TBumpOptions, workspacesOptions: TWorkspacesOptions) => TWorkspacesPackageBump[]; |
@@ -1,2 +0,2 @@ | ||
import { getDependentsCount, getDependentsOf } from "@auto/workspaces"; | ||
import { getCrossDependents, getDependentsCount, getDependentsOf } from "@auto/workspaces"; | ||
import { compareReleaseTypes } from "@auto/utils"; | ||
@@ -12,16 +12,8 @@ import { bumpRange } from "./bump-range"; | ||
const crossDependents = getCrossDependents(packages, workspacesOptions); | ||
const bumpStack = {}; | ||
const getStackDepsRange = (name, depName) => { | ||
if (!Reflect.has(bumpStack, name)) { | ||
return null; | ||
} | ||
const bumpDependents = (name, version, prevType, type) => { | ||
const dependents = getDependentsOf(crossDependents, packages, name); | ||
const stackItem = bumpStack[name]; | ||
return stackItem.deps !== null ? stackItem.deps[depName] : null; | ||
}; | ||
const bumpDependents = (name, version, type) => { | ||
const dependents = getDependentsOf(packages, name, workspacesOptions); | ||
if (dependents === null) { | ||
@@ -31,2 +23,6 @@ return; | ||
if (compareReleaseTypes(prevType, type) >= 0) { | ||
return; | ||
} | ||
for (const dependent of dependents) { | ||
@@ -39,8 +35,4 @@ const dependentPackage = packages[dependent.name]; | ||
if (dependent.range !== null) { | ||
const tempRange = bumpRange(dependent.range, version, type, bumpOptions); | ||
const stackRange = getStackDepsRange(dependent.name, name); | ||
if (tempRange !== stackRange) { | ||
bumpedRange = tempRange; | ||
} | ||
bumpedRange = bumpRange(dependent.range, version, type, bumpOptions); | ||
bumpedVersion = bumpVersion(dependentPackage.json.version, type, bumpOptions); | ||
} | ||
@@ -52,12 +44,7 @@ | ||
if (bumpedRange === null && bumpedDevRange === null) { | ||
continue; | ||
} | ||
let dependentPrevType = null; | ||
if (bumpedRange !== null) { | ||
bumpedVersion = bumpVersion(dependentPackage.json.version, type, bumpOptions); | ||
} | ||
if (Reflect.has(bumpStack, dependent.name)) { | ||
const bumpStackItem = bumpStack[dependent.name]; | ||
dependentPrevType = bumpStackItem.type; | ||
@@ -109,3 +96,3 @@ if (bumpedVersion !== null && compareReleaseTypes(bumpStackItem.type, type) < 0) { | ||
if (bumpedVersion !== null) { | ||
bumpDependents(dependent.name, dependentPackage.json.version, type); | ||
bumpDependents(dependent.name, dependentPackage.json.version, dependentPrevType, type); | ||
} | ||
@@ -117,2 +104,3 @@ } | ||
const packageItem = packages[bump.name]; | ||
let prevType = null; | ||
@@ -126,2 +114,3 @@ if (Reflect.has(bumpStack, bump.name)) { | ||
prevType = bumpStackItem.type; | ||
bumpStack[bump.name] = { ...bumpStackItem, | ||
@@ -142,3 +131,3 @@ version: bumpVersion(packageItem.json.version, bump.type, bumpOptions), | ||
bumpDependents(bump.name, packageItem.json.version, bump.type); | ||
bumpDependents(bump.name, packageItem.json.version, prevType, bump.type); | ||
} | ||
@@ -145,0 +134,0 @@ |
{ | ||
"name": "@auto/bump", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "", | ||
@@ -27,3 +27,3 @@ "keywords": "", | ||
"@auto/utils": "^0.0.15", | ||
"@auto/workspaces": "^0.0.19", | ||
"@auto/workspaces": "^0.0.20", | ||
"esm": "^3.0.82", | ||
@@ -30,0 +30,0 @@ "semver": "^5.5.1" |
7978
-2.05%176
-4.35%+ Added
- Removed
Updated