@lerna/project
Advanced tools
Comparing version 3.14.2 to 3.15.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.15.0](https://github.com/lerna/lerna/compare/v3.14.2...v3.15.0) (2019-06-09) | ||
### Features | ||
* **version:** Add `--create-release=[gitlab|github]` option ([#2073](https://github.com/lerna/lerna/issues/2073)) ([4974b78](https://github.com/lerna/lerna/commit/4974b78)) | ||
## [3.14.2](https://github.com/lerna/lerna/compare/v3.14.1...v3.14.2) (2019-06-09) | ||
@@ -8,0 +19,0 @@ |
@@ -9,2 +9,6 @@ "use strict"; | ||
// add new predicates HERE | ||
remap("command.version.githubRelease", "command.version.createRelease", { | ||
alsoRoot: true, | ||
toValue: value => value && "github", | ||
}), | ||
remap("command.publish.npmTag", "command.publish.distTag", { alsoRoot: true }), | ||
@@ -25,5 +29,6 @@ remap("command.publish.cdVersion", "command.publish.bump", { alsoRoot: true }), | ||
* @param {Boolean} opts.alsoRoot Whether to check root config as well | ||
* @param {Function} opts.toValue Return the new config value given the current value | ||
* @return {Function} predicate accepting (config, filepath) | ||
*/ | ||
function remap(search, target, { alsoRoot } = {}) { | ||
function remap(search, target, { alsoRoot, toValue } = {}) { | ||
const pathsToSearch = [search]; | ||
@@ -39,10 +44,8 @@ | ||
if (dotProp.has(obj.config, searchPath)) { | ||
const localPath = path.relative(".", obj.filepath); | ||
const fromVal = dotProp.get(obj.config, searchPath); | ||
const toVal = toValue ? toValue(fromVal) : fromVal; | ||
log.warn( | ||
"project", | ||
`Deprecated key "${searchPath}" found in ${localPath}\nPlease rename "${searchPath}" => "${target}"` | ||
); | ||
log.warn("project", deprecationMessage(obj, target, searchPath, fromVal, toVal)); | ||
dotProp.set(obj.config, target, dotProp.get(obj.config, searchPath)); | ||
dotProp.set(obj.config, target, toVal); | ||
dotProp.delete(obj.config, searchPath); | ||
@@ -56,4 +59,35 @@ } | ||
/** | ||
* Builds a deprecation message string that specifies | ||
* a deprecated config option and suggests a correction. | ||
* | ||
* @param {Object} obj A config object | ||
* @param {String} target Path of renamed option | ||
* @param {String} searchSearch Path to deprecated option | ||
* @param {Any} fromVal Current value of deprecated option | ||
* @param {Any} toVal Corrected value of deprecated option | ||
* @return {String} deprecation message | ||
*/ | ||
function deprecationMessage(obj, target, searchPath, fromVal, toVal) { | ||
const localPath = path.relative(".", obj.filepath); | ||
let from; | ||
let to; | ||
if (toVal === fromVal) { | ||
from = `"${searchPath}"`; | ||
to = `"${target}"`; | ||
} else { | ||
from = stringify({ [searchPath]: fromVal }); | ||
to = stringify({ [target]: toVal }); | ||
} | ||
return `Deprecated key "${searchPath}" found in ${localPath}\nPlease update ${from} => ${to}`; | ||
} | ||
function stringify(obj) { | ||
return JSON.stringify(obj).slice(1, -1); | ||
} | ||
function compose(...funcs) { | ||
return funcs.reduce((a, b) => (...args) => a(b(...args))); | ||
} |
{ | ||
"name": "@lerna/project", | ||
"version": "3.14.2", | ||
"version": "3.15.0", | ||
"description": "Lerna project configuration", | ||
@@ -48,3 +48,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "b22345b9870f62f1125e109fcc47d2e4260b9d09" | ||
"gitHead": "457d1e8a62f5caf0679973ae8bad564d7752ffd2" | ||
} |
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
22812
327