@lerna/conventional-commits
Advanced tools
Comparing version 3.18.5 to 3.22.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [3.22.0](https://github.com/lerna/lerna/compare/v3.21.0...v3.22.0) (2020-05-24) | ||
### Bug Fixes | ||
* **conventional-commits:** Support modern config builder functions ([#2546](https://github.com/lerna/lerna/issues/2546)) ([7ffb297](https://github.com/lerna/lerna/commit/7ffb297b5cab910f58153cd9decd1f3b58b0c4ed)), closes [#2138](https://github.com/lerna/lerna/issues/2138) | ||
### Features | ||
* **conventional-commits:** Preserve major version zero on breaking changes ([#2486](https://github.com/lerna/lerna/issues/2486)) ([6126e6c](https://github.com/lerna/lerna/commit/6126e6c6cb52405d7ff98d3b4017bf39dcdfa965)) | ||
## [3.18.5](https://github.com/lerna/lerna/compare/v3.18.4...v3.18.5) (2019-11-20) | ||
@@ -8,0 +24,0 @@ |
@@ -16,3 +16,3 @@ "use strict"; | ||
function resolveConfigPromise(presetPackageName) { | ||
function resolveConfigPromise(presetPackageName, presetConfig) { | ||
log.verbose("getChangelogConfig", "Attempting to resolve preset %j", presetPackageName); | ||
@@ -25,5 +25,10 @@ | ||
// legacy presets export an errback function instead of Q.all() | ||
if (isFunction(config)) { | ||
config = pify(config)(); | ||
try { | ||
// try assuming config builder function first | ||
config = config(presetConfig); | ||
} catch (_) { | ||
// legacy presets export an errback function instead of Q.all() | ||
config = pify(config)(); | ||
} | ||
} | ||
@@ -35,6 +40,11 @@ | ||
function getChangelogConfig(changelogPreset = "conventional-changelog-angular", rootPath) { | ||
let config = cfgCache.get(changelogPreset); | ||
const presetName = typeof changelogPreset === "string" ? changelogPreset : changelogPreset.name; | ||
const presetConfig = typeof changelogPreset === "object" ? changelogPreset : {}; | ||
const cacheKey = `${presetName}${presetConfig ? JSON.stringify(presetConfig) : ""}`; | ||
let config = cfgCache.get(cacheKey); | ||
if (!config) { | ||
let presetPackageName = changelogPreset; | ||
let presetPackageName = presetName; | ||
@@ -63,5 +73,5 @@ // https://github.com/npm/npm-package-arg#result-object | ||
try { | ||
config = resolveConfigPromise(presetPackageName); | ||
config = resolveConfigPromise(presetPackageName, presetConfig); | ||
cfgCache.set(changelogPreset, config); | ||
cfgCache.set(cacheKey, config); | ||
@@ -72,3 +82,3 @@ // early exit, yay | ||
log.verbose("getChangelogConfig", err.message); | ||
log.info("getChangelogConfig", "Auto-prefixing conventional-changelog preset %j", changelogPreset); | ||
log.info("getChangelogConfig", "Auto-prefixing conventional-changelog preset %j", presetName); | ||
@@ -93,5 +103,5 @@ // probably a deep shorthand subpath :P | ||
try { | ||
config = resolveConfigPromise(presetPackageName); | ||
config = resolveConfigPromise(presetPackageName, presetConfig); | ||
cfgCache.set(changelogPreset, config); | ||
cfgCache.set(cacheKey, config); | ||
} catch (err) { | ||
@@ -102,4 +112,4 @@ log.warn("getChangelogConfig", err.message); | ||
"EPRESET", | ||
`Unable to load conventional-changelog preset '${changelogPreset}'${ | ||
changelogPreset !== presetPackageName ? ` (${presetPackageName})` : "" | ||
`Unable to load conventional-changelog preset '${presetName}'${ | ||
presetName !== presetPackageName ? ` (${presetPackageName})` : "" | ||
}` | ||
@@ -106,0 +116,0 @@ ); |
@@ -54,3 +54,3 @@ "use strict"; | ||
// we still need to bump _something_ because lerna saw a change here | ||
const releaseType = data.releaseType || "patch"; | ||
let releaseType = data.releaseType || "patch"; | ||
@@ -63,2 +63,22 @@ if (prereleaseId) { | ||
} else { | ||
if (semver.major(pkg.version) === 0) { | ||
// According to semver, major version zero (0.y.z) is for initial | ||
// development. Anything MAY change at any time. The public API | ||
// SHOULD NOT be considered stable. The version 1.0.0 defines | ||
// the (initial stable) public API. | ||
// | ||
// To allow monorepos to use major version zero meaningfully, | ||
// the transition from 0.x to 1.x must be explicitly requested | ||
// by the user. Breaking changes MUST NOT automatically bump | ||
// the major version from 0.x to 1.x. | ||
// | ||
// The usual convention is to use semver-patch bumps for bugfix | ||
// releases and semver-minor for everything else, including | ||
// breaking changes. This matches the behavior of `^` operator | ||
// as implemented by `npm`. | ||
// | ||
if (releaseType === "major") { | ||
releaseType = "minor"; | ||
} | ||
} | ||
log.verbose(type, "increment %s by %s", pkg.version, releaseType); | ||
@@ -65,0 +85,0 @@ resolve(semver.inc(pkg.version, releaseType)); |
{ | ||
"name": "@lerna/conventional-commits", | ||
"version": "3.18.5", | ||
"version": "3.22.0", | ||
"description": "Lerna's internal interface to conventional-changelog and friends", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "2612f51e7eecec58eacf0571724e6989e4b8e42d" | ||
"gitHead": "0d45bd5f850aa42d54fe7eb61ba46a4249e1eb94" | ||
} |
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
22785
284