@commitlint/load
Advanced tools
Comparing version
227
lib/index.js
@@ -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_5) { | ||
return Promise.resolve(loadConfig(options.cwd, options.file)).then(function ($await_4) { | ||
try { | ||
loaded = $await_5; | ||
loaded = $await_4; | ||
base = loaded.filepath ? _path2.default.dirname(loaded.filepath) : options.cwd; | ||
@@ -53,32 +53,29 @@ config = valid((0, _lodash.merge)({}, loaded.config, seed)); | ||
// Resolve parserPreset key from flat-non-extended config | ||
// Resolve parserPreset key when overwritten by main config | ||
if (typeof config.parserPreset === 'string') { | ||
let resolvedParserConfig; | ||
resolvedParserPreset = (0, _resolveFrom2.default)(base, config.parserPreset); | ||
return Promise.resolve(require(resolvedParserPreset)).then(function ($await_6) { | ||
try { | ||
resolvedParserConfig = $await_6; | ||
// Resolve loaded parser preset factory | ||
if (typeof resolvedParserConfig === 'function') { | ||
return Promise.resolve(resolvedParserConfig()).then(function ($await_7) { | ||
try { | ||
resolvedParserConfig = $await_7; | ||
return $If_4.call(this); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} | ||
function $If_4() { | ||
config.parserPreset = { | ||
name: config.parserPreset, | ||
path: resolvedParserPreset, | ||
parserOpts: resolvedParserConfig.parserOpts | ||
}; | ||
return $If_1.call(this); | ||
} | ||
config.parserPreset = { | ||
name: config.parserPreset, | ||
path: resolvedParserPreset, | ||
parserOpts: require(resolvedParserPreset) | ||
}; | ||
} | ||
return $If_4.call(this); | ||
// Resolve extends key | ||
extended = (0, _resolveExtends2.default)(opts, { | ||
prefix: 'commitlint-config', | ||
cwd: base, | ||
parserPreset: config.parserPreset | ||
}); | ||
preset = valid((0, _lodash.mergeWith)(extended, config, w)); | ||
// Resolve parser-opts from preset | ||
if (typeof preset.parserPreset === 'object') { | ||
return Promise.resolve(loadParserOpts(preset.parserPreset.name, preset.parserPreset)).then(function ($await_5) { | ||
try { | ||
preset.parserPreset.parserOpts = $await_5; | ||
return $If_1.call(this); | ||
} catch ($boundEx) { | ||
@@ -90,96 +87,36 @@ return $error($boundEx); | ||
// Resolve extends key | ||
// Resolve config-relative formatter module | ||
function $If_1() { | ||
extended = (0, _resolveExtends2.default)(opts, { | ||
prefix: 'commitlint-config', | ||
cwd: base, | ||
parserPreset: config.parserPreset | ||
}); | ||
preset = valid((0, _lodash.mergeWith)(extended, config, w)); | ||
if (typeof config.formatter === 'string') { | ||
preset.formatter = _resolveFrom2.default.silent(base, config.formatter) || config.formatter; | ||
} | ||
// Await parser-preset if applicable | ||
if (typeof preset.parserPreset === 'object' && typeof preset.parserPreset.parserOpts === 'object' && typeof preset.parserPreset.parserOpts.then === 'function') { | ||
let parserPreset; | ||
return Promise.resolve(preset.parserPreset.parserOpts).then(function ($await_8) { | ||
try { | ||
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) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
// resolve plugins | ||
preset.plugins = {}; | ||
if (config.plugins && config.plugins.length) { | ||
config.plugins.forEach(pluginKey => { | ||
(0, _loadPlugin2.default)(preset.plugins, pluginKey, process.env.DEBUG === 'true'); | ||
}); | ||
} | ||
// Resolve config-relative formatter module | ||
// Execute rule config functions if needed | ||
return Promise.resolve(Promise.all(['rules'].map(key => [key, preset[key]]).map(item => new Promise(function ($return, $error) { | ||
var _item, key, value, executedValue; | ||
function $If_2() { | ||
if (typeof config.formatter === 'string') { | ||
preset.formatter = _resolveFrom2.default.silent(base, config.formatter) || config.formatter; | ||
} | ||
// resolve plugins | ||
preset.plugins = {}; | ||
if (config.plugins && config.plugins.length) { | ||
config.plugins.forEach(pluginKey => { | ||
(0, _loadPlugin2.default)(preset.plugins, pluginKey, process.env.DEBUG === 'true'); | ||
}); | ||
} | ||
// Execute rule config functions if needed | ||
return Promise.resolve(Promise.all(['rules'].map(key => [key, preset[key]]).map(item => new Promise(function ($return, $error) { | ||
var _item, key, value, executedValue; | ||
_item = (0, _slicedToArray3.default)(item, 2); | ||
key = _item[0], value = _item[1]; | ||
return Promise.resolve(Promise.all((0, _lodash.toPairs)(value || {}).map(entry => (0, _executeRule2.default)(entry)))).then(function ($await_10) { | ||
try { | ||
executedValue = $await_10; | ||
return $return([key, executedValue.reduce((registry, item) => { | ||
var _item2 = (0, _slicedToArray3.default)(item, 2); | ||
const key = _item2[0], | ||
value = _item2[1]; | ||
registry[key] = value; | ||
return registry; | ||
}, {})]); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
}.bind(this))))).then(function ($await_11) { | ||
_item = (0, _slicedToArray3.default)(item, 2); | ||
key = _item[0], value = _item[1]; | ||
return Promise.resolve(Promise.all((0, _lodash.toPairs)(value || {}).map(entry => (0, _executeRule2.default)(entry)))).then(function ($await_6) { | ||
try { | ||
executed = $await_11; | ||
executedValue = $await_6; | ||
return $return([key, executedValue.reduce((registry, item) => { | ||
var _item2 = (0, _slicedToArray3.default)(item, 2); | ||
// Merge executed config keys into preset | ||
return $return(executed.reduce((registry, item) => { | ||
var _item3 = (0, _slicedToArray3.default)(item, 2); | ||
const key = _item2[0], | ||
value = _item2[1]; | ||
const key = _item3[0], | ||
value = _item3[1]; | ||
registry[key] = value; | ||
return registry; | ||
}, preset)); | ||
}, {})]); | ||
} catch ($boundEx) { | ||
@@ -189,5 +126,21 @@ return $error($boundEx); | ||
}.bind(this), $error); | ||
} | ||
}.bind(this))))).then(function ($await_7) { | ||
try { | ||
executed = $await_7; | ||
return $If_2.call(this); | ||
// Merge executed config keys into preset | ||
return $return(executed.reduce((registry, item) => { | ||
var _item3 = (0, _slicedToArray3.default)(item, 2); | ||
const key = _item3[0], | ||
value = _item3[1]; | ||
registry[key] = value; | ||
return registry; | ||
}, preset)); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} | ||
@@ -209,5 +162,5 @@ | ||
searchPath = explicitPath ? explicitPath : cwd; | ||
return Promise.resolve(explore(searchPath)).then(function ($await_12) { | ||
return Promise.resolve(explore(searchPath)).then(function ($await_8) { | ||
try { | ||
local = $await_12; | ||
local = $await_8; | ||
@@ -226,3 +179,51 @@ | ||
} | ||
function loadParserOpts(parserName, pendingParser) { | ||
return new Promise(function ($return, $error) { | ||
var parser; | ||
return Promise.resolve(pendingParser).then(function ($await_9) { | ||
try { | ||
parser = $await_9; | ||
// Await parser opts if applicable | ||
if (typeof parser === 'object' && typeof parser.parserOpts === 'object' && typeof parser.parserOpts.then === 'function') { | ||
return Promise.resolve(parser.parserOpts).then(function ($await_10) { | ||
try { | ||
return $return($await_10.parserOpts); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} | ||
// Create parser opts from factory | ||
if (typeof parser === 'object' && typeof parser.parserOpts === 'function' && (0, _lodash.startsWith)(parserName, 'conventional-changelog-')) { | ||
return Promise.resolve(new Promise(resolve => { | ||
parser.parserOpts((_, opts) => { | ||
resolve(opts.parserOpts); | ||
}); | ||
})).then($return, $error); | ||
} | ||
// Pull nested paserOpts, might happen if overwritten with a module in main config | ||
function $If_3() { | ||
if (typeof parser === 'object' && typeof parser.parserOpts === 'object' && typeof parser.parserOpts.parserOpts === 'object') { | ||
return $return(parser.parserOpts.parserOpts); | ||
} | ||
return $return(parser.parserOpts); | ||
} | ||
if (typeof parser === 'object' && typeof parser.parserOpts === 'object' && typeof parser.parserOpts.parserOpts === 'object') { | ||
return $return(parser.parserOpts.parserOpts); | ||
}return $return(parser.parserOpts); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
}.bind(this)); | ||
} | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map |
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _execa = require('execa'); | ||
var _execa2 = _interopRequireDefault(_execa); | ||
var _resolveFrom = require('resolve-from'); | ||
@@ -200,36 +204,8 @@ | ||
(0, _ava2.default)('uses seed with parserPreset factory', t => new Promise(function ($return, $error) { | ||
var cwd, _ref2, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/parser-preset-factory')).then(function ($await_15) { | ||
try { | ||
cwd = $await_15; | ||
return Promise.resolve((0, _2.default)({ | ||
parserPreset: './conventional-changelog-factory' | ||
}, { cwd })).then(function ($await_16) { | ||
try { | ||
_ref2 = $await_16; | ||
actual = _ref2.parserPreset; | ||
t.is(actual.name, './conventional-changelog-factory'); | ||
t.deepEqual(actual.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)('invalid extend should throw', t => new Promise(function ($return, $error) { | ||
var cwd; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/extends-invalid')).then(function ($await_17) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/extends-invalid')).then(function ($await_15) { | ||
try { | ||
cwd = $await_17; | ||
return Promise.resolve(t.throws((0, _2.default)({}, { cwd }))).then(function ($await_18) { | ||
cwd = $await_15; | ||
return Promise.resolve(t.throws((0, _2.default)({}, { cwd }))).then(function ($await_16) { | ||
try { | ||
@@ -249,8 +225,8 @@ return $return(); | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/empty-object-file')).then(function ($await_19) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/empty-object-file')).then(function ($await_17) { | ||
try { | ||
cwd = $await_19; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_20) { | ||
cwd = $await_17; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_18) { | ||
try { | ||
actual = $await_20; | ||
actual = $await_18; | ||
@@ -271,8 +247,8 @@ t.deepEqual(actual.rules, {}); | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/empty-file')).then(function ($await_21) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/empty-file')).then(function ($await_19) { | ||
try { | ||
cwd = $await_21; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_22) { | ||
cwd = $await_19; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_20) { | ||
try { | ||
actual = $await_22; | ||
actual = $await_20; | ||
@@ -293,8 +269,8 @@ t.deepEqual(actual.extends, []); | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends/first-extended')).then(function ($await_23) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends/first-extended')).then(function ($await_21) { | ||
try { | ||
cwd = $await_23; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_24) { | ||
cwd = $await_21; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_22) { | ||
try { | ||
actual = $await_24; | ||
actual = $await_22; | ||
@@ -323,8 +299,8 @@ t.deepEqual(actual, { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends')).then(function ($await_25) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends')).then(function ($await_23) { | ||
try { | ||
cwd = $await_25; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_26) { | ||
cwd = $await_23; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_24) { | ||
try { | ||
actual = $await_26; | ||
actual = $await_24; | ||
@@ -354,8 +330,8 @@ t.deepEqual(actual, { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-json')).then(function ($await_27) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-json')).then(function ($await_25) { | ||
try { | ||
cwd = $await_27; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_28) { | ||
cwd = $await_25; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_26) { | ||
try { | ||
actual = $await_28; | ||
actual = $await_26; | ||
@@ -386,8 +362,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-yaml')).then(function ($await_29) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-yaml')).then(function ($await_27) { | ||
try { | ||
cwd = $await_29; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_30) { | ||
cwd = $await_27; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_28) { | ||
try { | ||
actual = $await_30; | ||
actual = $await_28; | ||
@@ -418,8 +394,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-js')).then(function ($await_31) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-js')).then(function ($await_29) { | ||
try { | ||
cwd = $await_31; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_32) { | ||
cwd = $await_29; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_30) { | ||
try { | ||
actual = $await_32; | ||
actual = $await_30; | ||
@@ -450,8 +426,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-package')).then(function ($await_33) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-extends-package')).then(function ($await_31) { | ||
try { | ||
cwd = $await_33; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_34) { | ||
cwd = $await_31; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_32) { | ||
try { | ||
actual = $await_34; | ||
actual = $await_32; | ||
@@ -482,8 +458,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/parser-preset-override')).then(function ($await_35) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/parser-preset-override')).then(function ($await_33) { | ||
try { | ||
cwd = $await_35; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_36) { | ||
cwd = $await_33; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_34) { | ||
try { | ||
actual = $await_36; | ||
actual = $await_34; | ||
@@ -507,8 +483,8 @@ t.is(actual.parserPreset.name, './custom'); | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-parser-preset')).then(function ($await_37) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-parser-preset')).then(function ($await_35) { | ||
try { | ||
cwd = $await_37; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_38) { | ||
cwd = $await_35; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_36) { | ||
try { | ||
actual = $await_38; | ||
actual = $await_36; | ||
@@ -529,35 +505,10 @@ t.is(actual.parserPreset.name, './conventional-changelog-custom'); | ||
(0, _ava2.default)('recursive extends with parserPreset factory', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-parser-preset-factory')).then(function ($await_39) { | ||
try { | ||
cwd = $await_39; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_40) { | ||
try { | ||
actual = $await_40; | ||
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) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-file')).then(function ($await_37) { | ||
try { | ||
cwd = $await_41; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_42) { | ||
cwd = $await_37; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_38) { | ||
try { | ||
actual = $await_42; | ||
actual = $await_38; | ||
@@ -587,8 +538,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-extend')).then(function ($await_43) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/trash-extend')).then(function ($await_39) { | ||
try { | ||
cwd = $await_43; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_44) { | ||
cwd = $await_39; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_40) { | ||
try { | ||
actual = $await_44; | ||
actual = $await_40; | ||
@@ -618,11 +569,11 @@ | ||
var outer, cwd, actual; | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_45) { | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_41) { | ||
try { | ||
outer = $await_45; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_46) { | ||
outer = $await_41; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_42) { | ||
try { | ||
cwd = _path2.default.join(outer, 'inner-scope', 'child-scope'); | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_47) { | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_43) { | ||
try { | ||
actual = $await_47; | ||
actual = $await_43; | ||
@@ -657,11 +608,11 @@ | ||
var outer, cwd, actual; | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_48) { | ||
return Promise.resolve(_test.fix.bootstrap('fixtures/outer-scope')).then(function ($await_44) { | ||
try { | ||
outer = $await_48; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_49) { | ||
outer = $await_44; | ||
return Promise.resolve(_test.git.init(_path2.default.join(outer, 'inner-scope'))).then(function ($await_45) { | ||
try { | ||
cwd = $await_49; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_50) { | ||
cwd = $await_45; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_46) { | ||
try { | ||
actual = $await_50; | ||
actual = $await_46; | ||
@@ -696,8 +647,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter')).then(function ($await_51) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter')).then(function ($await_47) { | ||
try { | ||
cwd = $await_51; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_52) { | ||
cwd = $await_47; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_48) { | ||
try { | ||
actual = $await_52; | ||
actual = $await_48; | ||
@@ -724,8 +675,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_49) { | ||
try { | ||
cwd = $await_53; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_54) { | ||
cwd = $await_49; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_50) { | ||
try { | ||
actual = $await_54; | ||
actual = $await_50; | ||
@@ -752,8 +703,8 @@ | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_55) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/formatter-local-module')).then(function ($await_51) { | ||
try { | ||
cwd = $await_55; | ||
return Promise.resolve((0, _2.default)({ formatter: './doesnt/exists.js' }, { cwd })).then(function ($await_56) { | ||
cwd = $await_51; | ||
return Promise.resolve((0, _2.default)({ formatter: './doesnt/exists.js' }, { cwd })).then(function ($await_52) { | ||
try { | ||
actual = $await_56; | ||
actual = $await_52; | ||
@@ -781,8 +732,8 @@ | ||
file = 'config/commitlint.config.js'; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/specify-config-file')).then(function ($await_57) { | ||
return Promise.resolve(_test.git.bootstrap('fixtures/specify-config-file')).then(function ($await_53) { | ||
try { | ||
cwd = $await_57; | ||
cwd = $await_53; | ||
configPath = _path2.default.join(cwd, file); | ||
before = JSON.stringify(require(configPath)); | ||
return Promise.resolve((0, _2.default)({ arbitraryField: true }, { cwd, file })).then(function ($await_58) { | ||
return Promise.resolve((0, _2.default)({ arbitraryField: true }, { cwd, file })).then(function ($await_54) { | ||
try { | ||
@@ -803,2 +754,82 @@ after = JSON.stringify(require(configPath)); | ||
}.bind(this))); | ||
(0, _ava2.default)('resolves parser preset from conventional commits', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.npm.bootstrap('fixtures/parser-preset-conventionalcommits')).then(function ($await_55) { | ||
try { | ||
cwd = $await_55; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_56) { | ||
try { | ||
actual = $await_56; | ||
t.is(actual.parserPreset.name, 'conventional-changelog-conventionalcommits'); | ||
t.is(typeof actual.parserPreset.parserOpts, 'object'); | ||
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)('resolves parser preset from conventional angular', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.npm.bootstrap('fixtures/parser-preset-angular')).then(function ($await_57) { | ||
try { | ||
cwd = $await_57; | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_58) { | ||
try { | ||
actual = $await_58; | ||
t.is(actual.parserPreset.name, 'conventional-changelog-angular'); | ||
t.is(typeof actual.parserPreset.parserOpts, 'object'); | ||
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)('recursive resolves parser preset from conventional atom', t => new Promise(function ($return, $error) { | ||
var cwd, actual; | ||
return Promise.resolve(_test.git.bootstrap('fixtures/recursive-parser-preset-conventional-atom')).then(function ($await_59) { | ||
try { | ||
cwd = $await_59; | ||
return Promise.resolve((0, _execa2.default)('npm', ['install'], { | ||
cwd: _path2.default.resolve(cwd, 'first-extended', 'second-extended') | ||
})).then(function ($await_60) { | ||
try { | ||
return Promise.resolve((0, _2.default)({}, { cwd })).then(function ($await_61) { | ||
try { | ||
actual = $await_61; | ||
t.is(actual.parserPreset.name, 'conventional-changelog-atom'); | ||
t.is(typeof actual.parserPreset.parserOpts, 'object'); | ||
t.deepEqual(actual.parserPreset.parserOpts.headerPattern, /^(:.*?:) (.*)$/); | ||
return $return(); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
} catch ($boundEx) { | ||
return $error($boundEx); | ||
} | ||
}.bind(this), $error); | ||
}.bind(this))); | ||
//# sourceMappingURL=index.test.js.map |
{ | ||
"name": "@commitlint/load", | ||
"version": "8.3.1", | ||
"version": "8.3.2", | ||
"description": "Load shared commitlint configuration", | ||
@@ -66,3 +66,3 @@ "main": "lib/index.js", | ||
"concurrently": "3.6.1", | ||
"cross-env": "6.0.0", | ||
"cross-env": "6.0.3", | ||
"execa": "0.11.0", | ||
@@ -72,4 +72,4 @@ "globby": "10.0.1" | ||
"dependencies": { | ||
"@commitlint/execute-rule": "^8.3.0", | ||
"@commitlint/resolve-extends": "^8.3.0", | ||
"@commitlint/execute-rule": "^8.3.2", | ||
"@commitlint/resolve-extends": "^8.3.2", | ||
"babel-runtime": "^6.23.0", | ||
@@ -81,3 +81,3 @@ "chalk": "2.4.2", | ||
}, | ||
"gitHead": "fbf23899463abc4d87bfa9bc0b04790de693fd33" | ||
"gitHead": "0382070379cfc841da8dc57718d232d1649dac6f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
98136
4.11%1188
2.06%