@lerna/check-working-tree
Advanced tools
Comparing version 3.13.3 to 3.14.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [3.14.0](https://github.com/lerna/lerna/compare/v3.13.4...v3.14.0) (2019-05-14) | ||
### Features | ||
* **publish:** Display uncommitted changes when validation fails ([#2066](https://github.com/lerna/lerna/issues/2066)) ([ea41fe9](https://github.com/lerna/lerna/commit/ea41fe9)) | ||
## Unpublished | ||
### Features | ||
* Display uncommitted changes in error message when working tree is dirty. | ||
## [3.13.3](https://github.com/lerna/lerna/compare/v3.13.2...v3.13.3) (2019-04-17) | ||
@@ -8,0 +25,0 @@ |
@@ -5,6 +5,8 @@ "use strict"; | ||
const ValidationError = require("@lerna/validation-error"); | ||
const collectUncommitted = require("@lerna/collect-uncommitted"); | ||
module.exports = checkWorkingTree; | ||
module.exports.mkThrowIfUncommitted = mkThrowIfUncommitted; | ||
module.exports.throwIfReleased = throwIfReleased; | ||
module.exports.throwIfUncommitted = throwIfUncommitted; | ||
module.exports.throwIfUncommitted = mkThrowIfUncommitted(); | ||
@@ -21,3 +23,3 @@ function checkWorkingTree({ cwd } = {}) { | ||
// prevent publish of uncommitted changes | ||
chain.then(throwIfUncommitted), | ||
chain.then(mkThrowIfUncommitted({ cwd })), | ||
]; | ||
@@ -38,9 +40,13 @@ | ||
function throwIfUncommitted({ isDirty }) { | ||
if (isDirty) { | ||
throw new ValidationError( | ||
"EUNCOMMIT", | ||
"Working tree has uncommitted changes, please commit or remove changes before continuing." | ||
); | ||
} | ||
const EUNCOMMIT_MSG = | ||
"Working tree has uncommitted changes, please commit or remove the following changes before continuing:\n"; | ||
function mkThrowIfUncommitted(options = {}) { | ||
return function throwIfUncommitted({ isDirty }) { | ||
if (isDirty) { | ||
return collectUncommitted(options).then(uncommitted => { | ||
throw new ValidationError("EUNCOMMIT", `${EUNCOMMIT_MSG}${uncommitted.join("\n")}`); | ||
}); | ||
} | ||
}; | ||
} |
{ | ||
"name": "@lerna/check-working-tree", | ||
"version": "3.13.3", | ||
"version": "3.14.0", | ||
"description": "Check git working tree status and error appropriately", | ||
@@ -33,6 +33,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@lerna/collect-uncommitted": "3.14.0", | ||
"@lerna/describe-ref": "3.13.3", | ||
"@lerna/validation-error": "3.13.0" | ||
}, | ||
"gitHead": "1496beb6278b001074d970bdd5869bb1f958d998" | ||
"gitHead": "39da145c67ea587457694f318f32f967b9d66ea9" | ||
} |
6397
40
3
+ Added@lerna/collect-uncommitted@3.14.0(transitive)