数通智联化工云平台
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.

48 lines
1.3 KiB

2 years ago
'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
2 years ago
if (typeof parameter === 'function') {
2 years ago
// parameter is a callback object
const config = {}
// FIXME: use presetOpts(config) for callback
2 years ago
Promise.all([
2 years ago
conventionalChangelog(config),
parserOpts(config),
recommendedBumpOpts(config),
writerOpts(config)
2 years ago
]).then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => {
parameter(null, {
gitRawCommitsOpts: {
noMerges: null
},
conventionalChangelog,
parserOpts,
recommendedBumpOpts,
writerOpts
})
2 years ago
})
} else {
const config = parameter || {}
return presetOpts(config)
}
}
function presetOpts (config) {
2 years ago
return Promise.all([
2 years ago
conventionalChangelog(config),
parserOpts(config),
recommendedBumpOpts(config),
writerOpts(config)
2 years ago
]).then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => ({
conventionalChangelog,
parserOpts,
recommendedBumpOpts,
writerOpts
}))
2 years ago
}