@lerna/version
Advanced tools
Comparing version 3.0.6 to 3.1.0
@@ -6,2 +6,16 @@ # Change Log | ||
<a name="3.1.0"></a> | ||
# [3.1.0](https://github.com/lerna/lerna/compare/v3.0.6...v3.1.0) (2018-08-17) | ||
### Bug Fixes | ||
* **command:** Detect composed commands more accurately ([1e51b39](https://github.com/lerna/lerna/commit/1e51b39)) | ||
* **command:** Log lerna CLI version with less ambiguity ([67494e7](https://github.com/lerna/lerna/commit/67494e7)) | ||
* **version:** Throw errors if tree is unclean or duplicating tagged release ([d8ee1cf](https://github.com/lerna/lerna/commit/d8ee1cf)) | ||
<a name="3.0.6"></a> | ||
@@ -8,0 +22,0 @@ ## [3.0.6](https://github.com/lerna/lerna/compare/v3.0.5...v3.0.6) (2018-08-16) |
71
index.js
@@ -14,2 +14,3 @@ "use strict"; | ||
const ConventionalCommitUtilities = require("@lerna/conventional-commits"); | ||
const checkWorkingTree = require("@lerna/check-working-tree"); | ||
const PromptUtilities = require("@lerna/prompt"); | ||
@@ -134,8 +135,4 @@ const output = require("@lerna/output"); | ||
if (!this.updates.length) { | ||
const message = this.options.composed | ||
? "No changed packages to publish" | ||
: "No changed packages to version"; | ||
this.logger.success(`No changed packages to ${this.composed ? "publish" : "version"}`); | ||
this.logger.success(message); | ||
// still exits zero, aka "ok" | ||
@@ -147,31 +144,14 @@ return false; | ||
return pWaterfall([ | ||
const tasks = [ | ||
() => this.getVersionsForUpdates(), | ||
versions => { | ||
if (this.project.isIndependent() || versions.size === this.filteredPackages.size) { | ||
// only partial fixed versions need to be checked | ||
this.updatesVersions = versions; | ||
} else { | ||
let hasBreakingChange; | ||
versions => this.setUpdatesForVersions(versions), | ||
() => this.confirmVersions(), | ||
]; | ||
for (const [name, bump] of versions) { | ||
hasBreakingChange = | ||
hasBreakingChange || isBreakingChange(this.packageGraph.get(name).version, bump); | ||
} | ||
// amending a commit probably means the working tree is dirty | ||
if (amend !== true) { | ||
tasks.unshift(() => checkWorkingTree(this.execOpts)); | ||
} | ||
if (hasBreakingChange) { | ||
const packages = | ||
this.filteredPackages.length === this.packageGraph.size | ||
? this.packageGraph | ||
: new Map(this.filteredPackages.map(({ name }) => [name, this.packageGraph.get(name)])); | ||
this.updates = Array.from(packages.values()); | ||
this.updatesVersions = new Map(this.updates.map(({ name }) => [name, this.globalVersion])); | ||
} else { | ||
this.updatesVersions = versions; | ||
} | ||
} | ||
}, | ||
() => this.confirmVersions(), | ||
]); | ||
return pWaterfall(tasks); | ||
} | ||
@@ -195,3 +175,3 @@ | ||
return pWaterfall(tasks).then(() => { | ||
if (!this.options.composed) { | ||
if (!this.composed) { | ||
this.logger.success("version", "finished"); | ||
@@ -324,2 +304,27 @@ } | ||
setUpdatesForVersions(versions) { | ||
if (this.project.isIndependent() || versions.size === this.filteredPackages.size) { | ||
// only partial fixed versions need to be checked | ||
this.updatesVersions = versions; | ||
} else { | ||
let hasBreakingChange; | ||
for (const [name, bump] of versions) { | ||
hasBreakingChange = hasBreakingChange || isBreakingChange(this.packageGraph.get(name).version, bump); | ||
} | ||
if (hasBreakingChange) { | ||
const packages = | ||
this.filteredPackages.length === this.packageGraph.size | ||
? this.packageGraph | ||
: new Map(this.filteredPackages.map(({ name }) => [name, this.packageGraph.get(name)])); | ||
this.updates = Array.from(packages.values()); | ||
this.updatesVersions = new Map(this.updates.map(({ name }) => [name, this.globalVersion])); | ||
} else { | ||
this.updatesVersions = versions; | ||
} | ||
} | ||
} | ||
confirmVersions() { | ||
@@ -345,3 +350,3 @@ const changes = this.updates.map(({ pkg }) => { | ||
// When composed from `lerna publish`, use this opportunity to confirm publishing | ||
const message = this.options.composed | ||
const message = this.composed | ||
? "Are you sure you want to publish these packages?" | ||
@@ -348,0 +353,0 @@ : "Are you sure you want to create these versions?"; |
{ | ||
"name": "@lerna/version", | ||
"version": "3.0.6", | ||
"version": "3.1.0", | ||
"description": "Bump version of packages changed since the last release", | ||
@@ -35,5 +35,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/check-working-tree": "^3.1.0", | ||
"@lerna/child-process": "^3.0.0", | ||
"@lerna/collect-updates": "^3.0.5", | ||
"@lerna/command": "^3.0.6", | ||
"@lerna/collect-updates": "^3.1.0", | ||
"@lerna/command": "^3.1.0", | ||
"@lerna/conventional-commits": "^3.0.2", | ||
@@ -55,3 +56,3 @@ "@lerna/output": "^3.0.0", | ||
}, | ||
"gitHead": "f2e67db8dbd6966288d7b351604a7a554ba905fa" | ||
"gitHead": "7f97c7bca038c690e2dd5d897e222fb5bca0a5e8" | ||
} |
45397
784
19
+ Added@lerna/check-working-tree@3.16.5(transitive)
+ Added@lerna/collect-uncommitted@3.16.5(transitive)
Updated@lerna/command@^3.1.0