Skip to content

Commit

Permalink
feat(app): Change commit message to chore app and add production flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Tallyb committed Jun 10, 2018
1 parent a93d63d commit 2b44751
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
17 changes: 4 additions & 13 deletions bin/mcfly-semantic-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,9 @@ const inquirer = require('inquirer');
const path = require('path');
const versionHelper = require('../lib/versionHelper');
const args = require('yargs')
.option('files', {
type: 'array',
desc: 'Files and files patterns to change'
}).argv;
// var files = args.files ? [].concat(args.files) : [];

// if (files.length === 0) {
// files.push('./package.json');
// }
// files = _.map(files, (file) => {
// return path.isAbsolute(file) ? file : path.join(process.cwd(), file);
// });
.option('files', { type: 'array', desc: 'Files and files patterns to change'})
.option('production', {type: 'boolean', desc: 'Generate production commit message'})
.argv;

var files;
var msg = {};
Expand Down Expand Up @@ -110,7 +101,7 @@ fileHelper.getFiles(args.files)
})
.then((msg) => {
console.log(chalk.yellow('Committing version...'));
return gitHelper.commitVersion(msg.nextVersion)
return gitHelper.commitVersion(msg.nextVersion, args.production)
.then(() => msg);
})
.delay(1000)
Expand Down
5 changes: 3 additions & 2 deletions lib/gitHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ var getCurrentBranch = function() {
});
};

var commitVersion = function(version) {
var commitVersion = function(version, production) {
let commitMessage = `chore(app): Version ${version} ${production ? ' production' : ''} `;
return Promise
.fromCallback((cb) => {
git
.add('./*')
.commit('docs(changelog): version ' + version)
.commit(commitMessage)
.addAnnotatedTag(version, 'v' + version)
.push('origin', 'master')
.pushTags('origin', cb);
Expand Down

0 comments on commit 2b44751

Please sign in to comment.