数通智联化工云平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.3 KiB

'use strict'
const conventionalChangelog = require('./conventional-changelog')
const parserOpts = require('./parser-opts')
const recommendedBumpOpts = require('./conventional-recommended-bump')
const writerOpts = require('./writer-opts')
module.exports = function (parameter) {
// parameter passed can be either a config object or a callback function
if (typeof parameter === 'function') {
// parameter is a callback object
const config = {}
// FIXME: use presetOpts(config) for callback
Promise.all([
conventionalChangelog(config),
parserOpts(config),
recommendedBumpOpts(config),
writerOpts(config)
]).then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => {
parameter(null, {
gitRawCommitsOpts: {
noMerges: null
},
conventionalChangelog,
parserOpts,
recommendedBumpOpts,
writerOpts
})
})
} else {
const config = parameter || {}
return presetOpts(config)
}
}
function presetOpts (config) {
return Promise.all([
conventionalChangelog(config),
parserOpts(config),
recommendedBumpOpts(config),
writerOpts(config)
]).then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => ({
conventionalChangelog,
parserOpts,
recommendedBumpOpts,
writerOpts
}))
}