@commitlint/load
Advanced tools
Comparing version 8.3.0 to 8.3.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [8.3.1](https://github.com/conventional-changelog/commitlint/compare/v8.3.0...v8.3.1) (2019-10-16) | ||
### Bug Fixes | ||
* **load:** resolve nested parser preset factories ([#831](https://github.com/conventional-changelog/commitlint/issues/831)) ([73a7df7](https://github.com/conventional-changelog/commitlint/commit/73a7df7)) | ||
# [8.3.0](https://github.com/conventional-changelog/commitlint/compare/v8.2.0...v8.3.0) (2019-10-16) | ||
@@ -8,0 +19,0 @@ |
@@ -44,5 +44,5 @@ 'use strict'; | ||
var loaded, base, config, opts, resolvedParserPreset, extended, preset, executed; | ||
return Promise.resolve(loadConfig(options.cwd, options.file)).then(function ($await_4) { | ||
return Promise.resolve(loadConfig(options.cwd, options.file)).then(function ($await_5) { | ||
try { | ||
loaded = $await_4; | ||
loaded = $await_5; | ||
base = loaded.filepath ? _path2.default.dirname(loaded.filepath) : options.cwd; | ||
@@ -53,16 +53,16 @@ config = valid((0, _lodash.merge)({}, loaded.config, seed)); | ||
// Resolve parserPreset key | ||
// Resolve parserPreset key from flat-non-extended config | ||
if (typeof config.parserPreset === 'string') { | ||
let resolvedParserConfig; | ||
resolvedParserPreset = (0, _resolveFrom2.default)(base, config.parserPreset); | ||
return Promise.resolve(require(resolvedParserPreset)).then(function ($await_5) { | ||
return Promise.resolve(require(resolvedParserPreset)).then(function ($await_6) { | ||
try { | ||
resolvedParserConfig = $await_5; | ||
resolvedParserConfig = $await_6; | ||
// Resolve loaded parser preset if its a factory | ||
// Resolve loaded parser preset factory | ||
if (typeof resolvedParserConfig === 'function') { | ||
return Promise.resolve(resolvedParserConfig()).then(function ($await_6) { | ||
return Promise.resolve(resolvedParserConfig()).then(function ($await_7) { | ||
try { | ||
resolvedParserConfig = $await_6; | ||
return $If_3.call(this); | ||
resolvedParserConfig = $await_7; | ||
return $If_4.call(this); | ||
} catch ($boundEx) { | ||
@@ -74,3 +74,3 @@ return $error($boundEx); | ||
function $If_3() { | ||
function $If_4() { | ||
config.parserPreset = { | ||
@@ -84,3 +84,3 @@ name: config.parserPreset, | ||
return $If_3.call(this); | ||
return $If_4.call(this); | ||
} catch ($boundEx) { | ||
@@ -104,6 +104,25 @@ return $error($boundEx); | ||
if (typeof preset.parserPreset === 'object' && typeof preset.parserPreset.parserOpts === 'object' && typeof preset.parserPreset.parserOpts.then === 'function') { | ||
return Promise.resolve(preset.parserPreset.parserOpts).then(function ($await_7) { | ||
let parserPreset; | ||
return Promise.resolve(preset.parserPreset.parserOpts).then(function ($await_8) { | ||
try { | ||
preset.parserPreset.parserOpts = $await_7.parserOpts; | ||
return $If_2.call(this); | ||
parserPreset = $await_8; | ||
// Resolve loaded parser preset factory from extended config | ||
if (typeof parserPreset === 'function') { | ||
return Promise.resolve(parserPreset()).then(function ($await_9) { | ||
try { | ||
parserPreset = $await_9; | ||
return $If_3.call(this); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} | ||
function $If_3() { | ||
preset.parserPreset.parserOpts = parserPreset.parserOpts; | ||
return $If_2.call(this); | ||
} | ||
return $If_3.call(this); | ||
} catch ($boundEx) { | ||
@@ -136,5 +155,5 @@ return $error($boundEx); | ||
key = _item[0], value = _item[1]; | ||
return Promise.resolve(Promise.all((0, _lodash.toPairs)(value || {}).map(entry => (0, _executeRule2.default)(entry)))).then(function ($await_8) { | ||
return Promise.resolve(Promise.all((0, _lodash.toPairs)(value || {}).map(entry => (0, _executeRule2.default)(entry)))).then(function ($await_10) { | ||
try { | ||
executedValue = $await_8; | ||
executedValue = $await_10; | ||
@@ -154,5 +173,5 @@ return $return([key, executedValue.reduce((registry, item) => { | ||
}.bind(this), $error); | ||
}.bind(this))))).then(function ($await_9) { | ||
}.bind(this))))).then(function ($await_11) { | ||
try { | ||
executed = $await_9; | ||
executed = $await_11; | ||
@@ -193,5 +212,5 @@ | ||
searchPath = explicitPath ? explicitPath : cwd; | ||
return Promise.resolve(explore(searchPath)).then(function ($await_10) { | ||
return Promise.resolve(explore(searchPath)).then(function ($await_12) { | ||
try { | ||
local = $await_10; | ||
local = $await_12; | ||
@@ -198,0 +217,0 @@ |
@@ -517,5 +517,5 @@ 'use strict'; | ||
(0, _ava2.default)('ignores unknow keys', t => new Promise(function ($return, $error) { | ||
(0, _ava2.default)('recursive extends with parserPreset factory', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-file')).then(function ($await_39) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-parser-preset-factory')).then(function ($await_39) { | ||
try { | ||
@@ -528,2 +528,27 @@ cwd = $await_39; | ||
t.is(actual.parserPreset.name, './conventional-changelog-factory'); | ||
t.deepEqual(actual.parserPreset.parserOpts, { | ||
headerPattern: /^(\w*)(?:\((.*)\))?-(.*)$/ | ||
}); | ||
return $return(); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
}.bind(this))); | ||
(0, _ava2.default)('ignores unknow keys', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-file')).then(function ($await_41) { | ||
try { | ||
cwd = $await_41; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_42) { | ||
try { | ||
actual = $await_42; | ||
t.deepEqual(actual, { | ||
@@ -551,8 +576,8 @@ formatter: '@commitlint/format', | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-extend')).then(function ($await_41) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-extend')).then(function ($await_43) { | ||
try { | ||
cwd = $await_41; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_42) { | ||
cwd = $await_43; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_44) { | ||
try { | ||
actual = $await_42; | ||
actual = $await_44; | ||
@@ -582,11 +607,11 @@ | ||
var outer, cwd, actual; | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_43) { | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_45) { | ||
try { | ||
outer = $await_43; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_44) { | ||
outer = $await_45; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_46) { | ||
try { | ||
cwd = _path2.default.join(outer, 'inner-scope', 'child-scope'); | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_45) { | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_47) { | ||
try { | ||
actual = $await_45; | ||
actual = $await_47; | ||
@@ -621,11 +646,11 @@ | ||
var outer, cwd, actual; | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_46) { | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_48) { | ||
try { | ||
outer = $await_46; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_47) { | ||
outer = $await_48; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_49) { | ||
try { | ||
cwd = $await_47; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_48) { | ||
cwd = $await_49; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_50) { | ||
try { | ||
actual = $await_48; | ||
actual = $await_50; | ||
@@ -660,8 +685,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter')).then(function ($await_49) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter')).then(function ($await_51) { | ||
try { | ||
cwd = $await_49; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_50) { | ||
cwd = $await_51; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_52) { | ||
try { | ||
actual = $await_50; | ||
actual = $await_52; | ||
@@ -688,8 +713,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_51) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_53) { | ||
try { | ||
cwd = $await_51; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_52) { | ||
cwd = $await_53; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_54) { | ||
try { | ||
actual = $await_52; | ||
actual = $await_54; | ||
@@ -716,8 +741,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_53) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_55) { | ||
try { | ||
cwd = $await_53; | ||
return Promise.resolve((0, _2.default)({ formatter: './doesnt/exists.js' }, { cwd })).then(function ($await_54) { | ||
cwd = $await_55; | ||
return Promise.resolve((0, _2.default)({ formatter: './doesnt/exists.js' }, { cwd })).then(function ($await_56) { | ||
try { | ||
actual = $await_54; | ||
actual = $await_56; | ||
@@ -745,8 +770,8 @@ | ||
file = 'config/commitlint.config.js'; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/specify-config-file')).then(function ($await_55) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/specify-config-file')).then(function ($await_57) { | ||
try { | ||
cwd = $await_55; | ||
cwd = $await_57; | ||
configPath = _path2.default.join(cwd, file); | ||
before = JSON.stringify(require(configPath)); | ||
return Promise.resolve((0, _2.default)({ arbitraryField: true }, { cwd, file })).then(function ($await_56) { | ||
return Promise.resolve((0, _2.default)({ arbitraryField: true }, { cwd, file })).then(function ($await_58) { | ||
try { | ||
@@ -753,0 +778,0 @@ after = JSON.stringify(require(configPath)); |
{ | ||
"name": "@commitlint/load", | ||
"version": "8.3.0", | ||
"version": "8.3.1", | ||
"description": "Load shared commitlint configuration", | ||
@@ -79,3 +79,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "e2edc43219f5005cee5222133859bb0e839c4a05" | ||
"gitHead": "fbf23899463abc4d87bfa9bc0b04790de693fd33" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
94263
1164