Skip to content

Commit

Permalink
Merge 948ba86 into 844cde6
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoreno committed Nov 22, 2018
2 parents 844cde6 + 948ba86 commit 1723ab9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
9 changes: 9 additions & 0 deletions command.js
Expand Up @@ -77,6 +77,15 @@ module.exports = require('yargs')
default: defaults.gitTagFallback,
describe: `fallback to git tags for version, if no meta-information file is found (e.g., package.json)`
})
.option('path', {
type: 'string',
describe: 'Only populate commits made under this path'
})
.option('preset', {
type: 'string',
default: defaults.preset,
describe: 'Commit message guideline preset (default: angular)'
})
.check((argv) => {
if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
throw Error('scripts must be an object')
Expand Down
3 changes: 2 additions & 1 deletion defaults.json
Expand Up @@ -10,5 +10,6 @@
"scripts": {},
"skip": {},
"dryRun": false,
"gitTagFallback": true
"gitTagFallback": true,
"preset": "angular"
}
8 changes: 5 additions & 3 deletions lib/lifecycles/bump.js
Expand Up @@ -24,7 +24,7 @@ function Bump (args, version) {
.then(runLifecycleScript.bind(this, args, 'prebump'))
.then((stdout) => {
if (stdout && stdout.trim().length) args.releaseAs = stdout.trim()
return bumpVersion(args.releaseAs)
return bumpVersion(args.releaseAs, args)
})
.then((release) => {
if (!args.firstRelease) {
Expand Down Expand Up @@ -125,15 +125,17 @@ function getTypePriority (type) {
return TypeList.indexOf(type)
}

function bumpVersion (releaseAs, callback) {
function bumpVersion (releaseAs, args) {
return new Promise((resolve, reject) => {
if (releaseAs) {
return resolve({
releaseType: releaseAs
})
} else {
conventionalRecommendedBump({
preset: 'angular'
debug: args.verbose && console.info.bind(console, 'conventional-recommended-bump'),
preset: args.preset || 'angular',
path: args.path
}, function (err, release) {
if (err) return reject(err)
else return resolve(release)
Expand Down
5 changes: 3 additions & 2 deletions lib/lifecycles/changelog.js
Expand Up @@ -30,9 +30,10 @@ function outputChangelog (args, newVersion) {
var context
if (args.dryRun) context = { version: newVersion }
var changelogStream = conventionalChangelog({
preset: 'angular',
debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
preset: args.preset || 'angular',
tagPrefix: args.tagPrefix
}, context, { merges: null })
}, context, { merges: null, path: args.path })
.on('error', function (err) {
return reject(err)
})
Expand Down

0 comments on commit 1723ab9

Please sign in to comment.