mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
Only commit rc and watched files
This commit is contained in:
parent
cb5895dbfd
commit
906d70667c
1 changed files with 8 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var _ = require('lodash/fp');
|
||||
|
||||
var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor';
|
||||
|
@ -36,19 +37,23 @@ function getRepoInfo(cb) {
|
|||
});
|
||||
}
|
||||
|
||||
function spawnCommand(args, cb) {
|
||||
function spawnGitCommand(args, cb) {
|
||||
var git = spawn('git', args);
|
||||
git.stderr.on('data', cb);
|
||||
git.on('close', cb);
|
||||
}
|
||||
|
||||
function commit(options, data, cb) {
|
||||
spawnCommand(['add', '.'], function (error) {
|
||||
var files = options.files.concat(options.config);
|
||||
var absolutePathFiles = files.map(function (file) {
|
||||
return path.resolve(process.cwd(), file);
|
||||
});
|
||||
spawnGitCommand(['add'].concat(absolutePathFiles), function (error) {
|
||||
if (error) {
|
||||
return cb(error);
|
||||
}
|
||||
var commitMessage = _.template(options.commitTemplate || commitTemplate)(data);
|
||||
spawnCommand(['commit', '-m', commitMessage], cb);
|
||||
spawnGitCommand(['commit', '-m', commitMessage], cb);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue