diff --git a/command.js b/command.js index 095f9650c..3406cd00c 100755 --- a/command.js +++ b/command.js @@ -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') diff --git a/defaults.json b/defaults.json index b70e54697..17035be47 100644 --- a/defaults.json +++ b/defaults.json @@ -10,5 +10,6 @@ "scripts": {}, "skip": {}, "dryRun": false, - "gitTagFallback": true + "gitTagFallback": true, + "preset": "angular" } diff --git a/lib/lifecycles/bump.js b/lib/lifecycles/bump.js index 0401b7e9b..11028c83d 100644 --- a/lib/lifecycles/bump.js +++ b/lib/lifecycles/bump.js @@ -27,7 +27,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) { @@ -128,7 +128,7 @@ function getTypePriority (type) { return TypeList.indexOf(type) } -function bumpVersion (releaseAs, callback) { +function bumpVersion (releaseAs, args) { return new Promise((resolve, reject) => { if (releaseAs) { return resolve({ @@ -136,7 +136,9 @@ function bumpVersion (releaseAs, callback) { }) } 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) diff --git a/lib/lifecycles/changelog.js b/lib/lifecycles/changelog.js index 084914d11..fb2e0f9f3 100644 --- a/lib/lifecycles/changelog.js +++ b/lib/lifecycles/changelog.js @@ -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) })