Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
40
node_modules/gulp-git/lib/add.js
generated
vendored
Normal file
40
node_modules/gulp-git/lib/add.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var paths = [];
|
||||
var files = [];
|
||||
var fileCwd = process.cwd();
|
||||
|
||||
var write = function(file, enc, cb) {
|
||||
paths.push(file.path);
|
||||
files.push(file);
|
||||
fileCwd = file.cwd;
|
||||
cb();
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var cwd = opt.cwd || fileCwd;
|
||||
|
||||
var cmd = 'git add ' + escape(paths) + ' ' + opt.args;
|
||||
var that = this;
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(that.push.bind(that));
|
||||
that.emit('end');
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
28
node_modules/gulp-git/lib/addRemote.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/addRemote.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, url, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!url) return cb(new Error('gulp-git: Repo URL is required git.addRemote("origin", "https://github.com/user/repo.git")'));
|
||||
if (!remote) remote = 'origin';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git remote add ' + opt.args + ' ' + escape([remote, url]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
22
node_modules/gulp-git/lib/addSubmodule.js
generated
vendored
Normal file
22
node_modules/gulp-git/lib/addSubmodule.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (url, name, opt, cb) {
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!url) return cb(new Error('gulp-git: Repo URL is required git.submodule.add("https://github.com/user/repo.git", "repoName")'));
|
||||
if (!name) name = '';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = '';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git submodule add ' + opt.args + ' ' + url + ' ' + name;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err && cb) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
if (cb) cb();
|
||||
});
|
||||
};
|
30
node_modules/gulp-git/lib/branch.js
generated
vendored
Normal file
30
node_modules/gulp-git/lib/branch.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
// want to get the current branch instead?
|
||||
// git.revParse({args:'--abbrev-ref HEAD'})
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) return cb(new Error('gulp-git: Branch name is required git.branch("name")'));
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git branch ' + opt.args + ' ' + escape([branch]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null, stdout);
|
||||
});
|
||||
};
|
109
node_modules/gulp-git/lib/catFile.js
generated
vendored
Normal file
109
node_modules/gulp-git/lib/catFile.js
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
'use strict';
|
||||
/**
|
||||
* catFile
|
||||
* @module gulp-git/lib/catFile
|
||||
*/
|
||||
|
||||
var through = require('through2');
|
||||
var PluginError = require('plugin-error');
|
||||
var spawn = require('child_process').spawn;
|
||||
var stripBom = require('strip-bom-stream');
|
||||
|
||||
/**
|
||||
* get a buffer.
|
||||
* @callback requestCallback
|
||||
* @param {buffer} buf
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert stream to buffer
|
||||
*
|
||||
* @param {Stream} stream stream that what to read
|
||||
* @param {readStreamCallback} callback function that receive buffer
|
||||
* @returns {void}
|
||||
*/
|
||||
function readStream(stream, callback) {
|
||||
var buf;
|
||||
stream.on('data', function(data) {
|
||||
if (buf) {
|
||||
buf = Buffer.concat([buf, data]);
|
||||
} else {
|
||||
buf = data;
|
||||
}
|
||||
});
|
||||
stream.once('finish', function() {
|
||||
if (buf) {
|
||||
callback(buf);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} catFileOptions
|
||||
* @property {boolean} stripBOM {@link https://github.com/gulpjs/vinyl-fs#optionsstripbom}
|
||||
* @property {boolean} buffer {@link https://github.com/gulpjs/vinyl-fs#optionsbuffer}
|
||||
*/
|
||||
|
||||
/**
|
||||
* read vinyl file contents
|
||||
* @param {catFileOptions} opt [catFileOptions]{@link module:gulp-git/lib/catFile~catFileOptions}
|
||||
* @returns {stream} stream of vinyl `File` objects.
|
||||
*/
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (undefined === opt.stripBOM || null === opt.stripBOM) opt.stripBOM = true;
|
||||
if (undefined === opt.buffer || null === opt.buffer) opt.buffer = true;
|
||||
|
||||
/**
|
||||
* transform function of stream {@link https://nodejs.org/docs/latest/api/stream.html#stream_transform_transform_chunk_encoding_callback}
|
||||
*
|
||||
* @param {vinyl} file The file to be transformed.
|
||||
* @param {any} enc encoding type.
|
||||
* @param {function} cb A callback function (optionally with an error argument and data) to be called after the supplied `file` has been processed.
|
||||
* @returns {void}
|
||||
*/
|
||||
var write = function(file, enc, cb) {
|
||||
|
||||
var hash = file.git && file.git.hash;
|
||||
|
||||
/**
|
||||
* set file contents and send file to stream
|
||||
*
|
||||
* @param {Buffer} contents file contents
|
||||
* @returns {void}
|
||||
*/
|
||||
var sendFile = function(contents) {
|
||||
if (contents) {
|
||||
file.contents = contents;
|
||||
}
|
||||
return cb(null, file);
|
||||
};
|
||||
|
||||
if (!hash || /^0+$/.test(hash)) {
|
||||
return sendFile();
|
||||
}
|
||||
|
||||
var catFile = spawn('git', ['cat-file', 'blob', hash], {
|
||||
cwd: file.cwd
|
||||
});
|
||||
|
||||
var contents = catFile.stdout;
|
||||
var that = this;
|
||||
|
||||
readStream(catFile.stderr, function(error) {
|
||||
that.emit('error', new PluginError('gulp-git', 'Command failed: ' + catFile.spawnargs.join(' ').trim() + '\n' + error.toString()));
|
||||
});
|
||||
|
||||
if (opt.stripBOM) {
|
||||
contents = contents.pipe(stripBom());
|
||||
}
|
||||
|
||||
if (opt.buffer) {
|
||||
readStream(contents, sendFile);
|
||||
} else {
|
||||
sendFile(contents);
|
||||
}
|
||||
};
|
||||
var stream = through.obj(write);
|
||||
return stream;
|
||||
};
|
27
node_modules/gulp-git/lib/checkout.js
generated
vendored
Normal file
27
node_modules/gulp-git/lib/checkout.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) throw new Error('gulp-git: Branch name is require git.checkout("name")');
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git checkout ' + opt.args + ' ' + escape([branch]);
|
||||
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null);
|
||||
});
|
||||
};
|
29
node_modules/gulp-git/lib/checkoutFiles.js
generated
vendored
Normal file
29
node_modules/gulp-git/lib/checkoutFiles.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
function checkout(file, enc, cb) {
|
||||
var that = this;
|
||||
var cmd = 'git checkout ' + opt.args + ' ' + escape([file.path]);
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec(cmd, {cwd: file.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
that.push(file);
|
||||
cb(null);
|
||||
});
|
||||
}
|
||||
|
||||
// Return a stream
|
||||
return through.obj(checkout);
|
||||
};
|
40
node_modules/gulp-git/lib/clean.js
generated
vendored
Normal file
40
node_modules/gulp-git/lib/clean.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (paths, opt, cb) {
|
||||
if (!cb) {
|
||||
if (typeof opt === 'function') {
|
||||
// passed in 2 arguments
|
||||
cb = opt;
|
||||
if (typeof paths === 'object') {
|
||||
opt = paths;
|
||||
paths = '';
|
||||
}
|
||||
else opt = {};
|
||||
}
|
||||
else {
|
||||
// passed in only cb
|
||||
cb = paths;
|
||||
paths = '';
|
||||
opt = {};
|
||||
}
|
||||
}
|
||||
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git clean ' + opt.args + ' ' + (paths.trim() ? (' -- ' + escape(paths)) : '');
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, { cwd: opt.cwd, maxBuffer: maxBuffer }, function (err, stdout, stderr) {
|
||||
if (err)
|
||||
return cb(err);
|
||||
if (!opt.quiet)
|
||||
log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
26
node_modules/gulp-git/lib/clone.js
generated
vendored
Normal file
26
node_modules/gulp-git/lib/clone.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git clone ' + escape([remote]) + ' ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
120
node_modules/gulp-git/lib/commit.js
generated
vendored
Normal file
120
node_modules/gulp-git/lib/commit.js
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
var path = require('path');
|
||||
|
||||
// want to get the current git hash instead?
|
||||
// git.revParse({args:'--short HEAD'})
|
||||
|
||||
module.exports = function(message, opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!message) {
|
||||
if (opt.args.indexOf('--amend') === -1 && opt.disableMessageRequirement !== true) {
|
||||
throw new Error('gulp-git: Commit message is required git.commit("commit message") or --amend arg must be given');
|
||||
}
|
||||
}
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var files = [];
|
||||
var paths = [];
|
||||
|
||||
var write = function(file, enc, cb) {
|
||||
files.push(file);
|
||||
paths.push(path.relative(opt.cwd, file.path).replace('\\', '/') || '.');
|
||||
cb();
|
||||
};
|
||||
|
||||
var messageEntry = function(entry) {
|
||||
return '-m "' + entry + '" ';
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var writeStdin = false;
|
||||
var cmd = 'git commit ';
|
||||
// Allow delayed execution to determine the message
|
||||
if (typeof message === 'function') {
|
||||
message = message();
|
||||
}
|
||||
|
||||
if (message && opt.args.indexOf('--amend') === -1) {
|
||||
|
||||
// Check if the message is multiline
|
||||
if (message && message instanceof Array) {
|
||||
|
||||
if (opt.multiline) {
|
||||
writeStdin = true;
|
||||
message = message.join('\n');
|
||||
} else {
|
||||
var messageExpanded = '';
|
||||
|
||||
// repeat -m as needed
|
||||
for (var i = 0; i < message.length; i++) {
|
||||
messageExpanded += messageEntry(message[i]);
|
||||
}
|
||||
cmd += messageExpanded + opt.args;
|
||||
}
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' ' + escape(paths);
|
||||
}
|
||||
} else {
|
||||
if (~message.indexOf('\n')) {
|
||||
writeStdin = true;
|
||||
} else {
|
||||
cmd += '-m "' + message + '" ' + opt.args;
|
||||
}
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' ' + escape(paths);
|
||||
}
|
||||
}
|
||||
} else if (opt.disableMessageRequirement === true) {
|
||||
cmd += opt.args;
|
||||
} else {
|
||||
// When amending, just add the file automatically and do not include the message not the file.
|
||||
// Also, add all the files and avoid lauching the editor (even if --no-editor was added)
|
||||
cmd += '-a ' + opt.args + (opt.args.indexOf('--no-edit') === -1 ? ' --no-edit' : '');
|
||||
}
|
||||
var self = this;
|
||||
|
||||
// If `message` was an array and `opt.multiline` was true
|
||||
// or was a string containing newlines, we append '-F -'
|
||||
if (writeStdin) {
|
||||
cmd += ' -F -';
|
||||
}
|
||||
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' .';
|
||||
}
|
||||
|
||||
var execChildProcess = exec(cmd, opt, function(err, stdout, stderr) {
|
||||
if (err && (String(stdout).indexOf('no changes added to commit') === 0)) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(self.push.bind(self));
|
||||
self.emit('end');
|
||||
return cb();
|
||||
});
|
||||
|
||||
if (writeStdin) {
|
||||
execChildProcess.stdin.write(message);
|
||||
execChildProcess.stdin.end();
|
||||
}
|
||||
|
||||
// If the user wants, we'll emit data events during exec
|
||||
// they can listen to them with .on('data',function(data){ });
|
||||
// in their task
|
||||
if (opt.emitData) {
|
||||
execChildProcess.stdout.on('data', function(data) {
|
||||
self.emit('data', data);
|
||||
});
|
||||
execChildProcess.stderr.on('data', function(data) {
|
||||
self.emit('data', data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
121
node_modules/gulp-git/lib/diff.js
generated
vendored
Normal file
121
node_modules/gulp-git/lib/diff.js
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
'use strict';
|
||||
/**
|
||||
* diff
|
||||
* @module gulp-git/lib/diff
|
||||
*/
|
||||
|
||||
var Vinyl = require('vinyl');
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var path = require('path');
|
||||
var exec = require('child_process').exec;
|
||||
var catFile = require('./catFile');
|
||||
|
||||
// https://git-scm.com/docs/git-diff#_raw_output_format
|
||||
/* eslint-disable */
|
||||
var RE_DIFF_RESULT = /\:(\w+)\s+(\w+)\s+(\w+)(?:\.{3})?\s+(\w+)(?:\.{3})?\s+(\w+)(\u0000|\t|\s+)(.+?)(?:\6|\n)(?:([^:]+?)\6)?/g;
|
||||
/* eslint-enable */
|
||||
|
||||
function getReaslt(data) {
|
||||
var result = [];
|
||||
if (data && data.length) {
|
||||
var str = data.toString();
|
||||
var match;
|
||||
RE_DIFF_RESULT.lastIndex = 0;
|
||||
while ((match = RE_DIFF_RESULT.exec(str))) {
|
||||
result.push({
|
||||
// mode for compare "src"
|
||||
srcMode: match[1],
|
||||
// mode for compare "dst"
|
||||
dstMode: match[2],
|
||||
// sha1 for compare "src"
|
||||
srcHash: match[3],
|
||||
// sha1 for compare "dst"
|
||||
dstHash: match[4],
|
||||
// status
|
||||
status: match[5],
|
||||
// path for compare "src"
|
||||
srcPath: match[7],
|
||||
// path for compare "dst"
|
||||
dstPath: match[8] || match[7],
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} diffOptions
|
||||
* @property {string} cwd {@link https://github.com/gulpjs/vinyl-fs#optionscwd}
|
||||
* @property {string} base {@link https://github.com/gulpjs/vinyl-fs#optionsbase}
|
||||
* @property {boolean} read {@link https://github.com/gulpjs/vinyl-fs#optionsread}
|
||||
* @property {boolean} buffer {@link https://github.com/gulpjs/vinyl-fs#optionsbuffer}
|
||||
* @property {boolean} stripBOM {@link https://github.com/gulpjs/vinyl-fs#optionsstripbom}
|
||||
* @property {boolean} log show log in console
|
||||
* @property {string[]} args Command parameter for `git diff`
|
||||
*/
|
||||
|
||||
/**
|
||||
* get git diff result as a stream of vinyl `File` objects.
|
||||
*
|
||||
* @example
|
||||
const git = require('gulp-git');
|
||||
const eslint = require('gulp-eslint');
|
||||
git.diff('--cached', {
|
||||
args: '-- *.js'
|
||||
})
|
||||
.pipe(eslint())
|
||||
* @param {string} compare compare arg for `git diff`
|
||||
* @param {diffOptions} opt [diffOptions]{@link module:gulp-git/lib/diff~diffOptions}
|
||||
* @returns {stream} stream of vinyl `File` objects.
|
||||
*/
|
||||
module.exports = function (compare, opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
// https://github.com/gulpjs/vinyl-fs#optionsread
|
||||
if (undefined === opt.read || null === opt.read) opt.read = true;
|
||||
if (undefined === opt.log || null === opt.log) opt.log = true;
|
||||
|
||||
var srcStream = through.obj();
|
||||
var cmd = compare;
|
||||
|
||||
if (!/--diff-filter=/.test(opt.args)) {
|
||||
cmd += ' --diff-filter=ACM';
|
||||
}
|
||||
if (opt.args) {
|
||||
cmd += ' ' + opt.args;
|
||||
}
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec('git diff --raw -z ' + cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout) {
|
||||
if (err) return srcStream.emit('error', err);
|
||||
var files = getReaslt(stdout);
|
||||
|
||||
if (opt.log) {
|
||||
log('git diff --name-status ' + cmd + '\n' + files.map(function(diff) {
|
||||
return diff.status + '\t' + diff.dstPath;
|
||||
}).join('\n'));
|
||||
}
|
||||
|
||||
files.forEach(function(diff) {
|
||||
srcStream.write(new Vinyl({
|
||||
path: path.resolve(opt.cwd, diff.dstPath),
|
||||
cwd: opt.cwd,
|
||||
base: opt.base,
|
||||
git: {
|
||||
hash: diff.dstHash,
|
||||
diff: diff
|
||||
}
|
||||
}));
|
||||
});
|
||||
srcStream.end();
|
||||
});
|
||||
|
||||
if (opt.read) {
|
||||
// read file contents when opt.read is `true`
|
||||
return srcStream.pipe(catFile(opt));
|
||||
}
|
||||
|
||||
return srcStream;
|
||||
};
|
29
node_modules/gulp-git/lib/exec.js
generated
vendored
Normal file
29
node_modules/gulp-git/lib/exec.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = { };
|
||||
if (!opt.log) opt.log = !cb;
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git ' + opt.args;
|
||||
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err, stderr);
|
||||
if (opt.log && !opt.quiet) log(cmd + '\n' + stdout, stderr);
|
||||
else {
|
||||
if (!opt.quiet) log(cmd + ' (log : false)', stderr);
|
||||
}
|
||||
cb(err, stdout);
|
||||
});
|
||||
};
|
35
node_modules/gulp-git/lib/fetch.js
generated
vendored
Normal file
35
node_modules/gulp-git/lib/fetch.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!branch) branch = '';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!remote && opt.args.indexOf('--all') === -1) remote = 'origin';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git fetch ' + opt.args;
|
||||
var args = [];
|
||||
if (remote)
|
||||
args.push(remote);
|
||||
if (branch)
|
||||
args = args.concat(branch);
|
||||
if (args.length > 0)
|
||||
cmd += escape(args);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
26
node_modules/gulp-git/lib/init.js
generated
vendored
Normal file
26
node_modules/gulp-git/lib/init.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git init ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
|
||||
};
|
27
node_modules/gulp-git/lib/merge.js
generated
vendored
Normal file
27
node_modules/gulp-git/lib/merge.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) return cb && cb(new Error('gulp-git: Branch name is require git.merge("name")'));
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git merge ' + opt.args + ' ' + escape([branch]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
37
node_modules/gulp-git/lib/pull.js
generated
vendored
Normal file
37
node_modules/gulp-git/lib/pull.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
// pull with callback only
|
||||
if (!cb && typeof remote === 'function') {
|
||||
cb = remote;
|
||||
remote = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git pull ' + opt.args;
|
||||
if (typeof remote === 'string') {
|
||||
cmd += ' ' + escape(remote);
|
||||
}
|
||||
if (branch && typeof branch === 'string' || branch && branch[0]) {
|
||||
cmd += ' ' + escape([].concat(branch));
|
||||
}
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
59
node_modules/gulp-git/lib/push.js
generated
vendored
Normal file
59
node_modules/gulp-git/lib/push.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
var revParse = require('./revParse');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
|
||||
if (!remote) remote = 'origin';
|
||||
|
||||
function setBranch(cb2) {
|
||||
if (branch && typeof branch === 'function') {
|
||||
cb = branch;
|
||||
branch = null;
|
||||
}
|
||||
if (branch && Object.prototype.toString.call(branch) === '[object Object]') {
|
||||
opt = branch;
|
||||
branch = null;
|
||||
}
|
||||
if (!branch) {
|
||||
revParse({ args: '--abbrev-ref HEAD' },
|
||||
function callback(err, out) {
|
||||
if (err) return cb2(err);
|
||||
branch = out;
|
||||
cb2();
|
||||
});
|
||||
} else {
|
||||
cb2();
|
||||
}
|
||||
}
|
||||
|
||||
function flush(err) {
|
||||
if (err) return cb(err);
|
||||
if (!cb && typeof opt === 'function') {
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function() {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git push ' + escape([].concat(remote, branch)) + ' ' + opt.args;
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, {
|
||||
cwd: opt.cwd,
|
||||
maxBuffer: maxBuffer
|
||||
}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
return setBranch(flush);
|
||||
|
||||
};
|
31
node_modules/gulp-git/lib/removeRemote.js
generated
vendored
Normal file
31
node_modules/gulp-git/lib/removeRemote.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!remote || typeof remote !== 'string') {
|
||||
var error = new Error('gulp-git: remote is required git.removeRemote("origin")');
|
||||
if (!cb || typeof cb !== 'function') throw error;
|
||||
return cb(error);
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git remote remove ' + opt.args + ' ' + escape([remote]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
28
node_modules/gulp-git/lib/reset.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/reset.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (commit, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!commit) commit = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git reset ' + opt.args + ' ' + escape([commit]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
|
||||
};
|
35
node_modules/gulp-git/lib/revParse.js
generated
vendored
Normal file
35
node_modules/gulp-git/lib/revParse.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
/*
|
||||
great examples:
|
||||
`git rev-parse HEAD`: get current git hash
|
||||
`git rev-parse --short HEAD`: get short git hash
|
||||
`git rev-parse --abbrev-ref HEAD`: get current branch name
|
||||
`git rev-parse --show-toplevel`: working directory path
|
||||
see https://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html
|
||||
*/
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' '; // it will likely not give you what you want
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git rev-parse ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (stdout) stdout = stdout.trim(); // Trim trailing cr-lf
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(err, stdout); // return stdout to the user
|
||||
});
|
||||
};
|
38
node_modules/gulp-git/lib/rm.js
generated
vendored
Normal file
38
node_modules/gulp-git/lib/rm.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var paths = [];
|
||||
var files = [];
|
||||
var fileCwd = process.cwd;
|
||||
var write = function(file, enc, cb) {
|
||||
paths.push(file.path);
|
||||
files.push(file);
|
||||
fileCwd = file.cwd;
|
||||
cb();
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var cwd = opt.cwd || fileCwd;
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git rm ' + escape(paths) + ' ' + opt.args;
|
||||
var that = this;
|
||||
exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(that.push.bind(that));
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
23
node_modules/gulp-git/lib/showBranch.js
generated
vendored
Normal file
23
node_modules/gulp-git/lib/showBranch.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git show-branch ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null, stdout);
|
||||
});
|
||||
};
|
28
node_modules/gulp-git/lib/stash.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/stash.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function(opt, cb) {
|
||||
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = 'save --include-untracked "gulp-stash"';
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git stash ' + opt.args;
|
||||
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null);
|
||||
});
|
||||
|
||||
};
|
24
node_modules/gulp-git/lib/status.js
generated
vendored
Normal file
24
node_modules/gulp-git/lib/status.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
|
||||
var cmd = 'git status ' + opt.args;
|
||||
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err, stderr);
|
||||
if (!opt.quiet) log(cmd + '\n' + stdout, stderr);
|
||||
if (cb) cb(err, stdout);
|
||||
});
|
||||
};
|
49
node_modules/gulp-git/lib/tag.js
generated
vendored
Normal file
49
node_modules/gulp-git/lib/tag.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var template = require('lodash.template');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (version, message, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb && typeof version === 'function') {
|
||||
cb = version;
|
||||
version = '';
|
||||
message = '';
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!message) {
|
||||
opt.lightWeight = true;
|
||||
message = '';
|
||||
}
|
||||
else message = escape([message]);
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var signedarg = opt.signed ? ' -s ' : ' -a ';
|
||||
|
||||
var cmd = 'git tag';
|
||||
if (version !== '') {
|
||||
if (!opt.lightWeight) {
|
||||
cmd += ' ' + signedarg + ' -m ' + message + ' ';
|
||||
}
|
||||
cmd += opt.args + ' ' + escape([version]);
|
||||
}
|
||||
var templ = template(cmd)({file: message});
|
||||
return exec(templ, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet && version !== '') log(stdout, stderr);
|
||||
if (version === '') {
|
||||
stdout = stdout.split('\n');
|
||||
}
|
||||
return cb(null, stdout);
|
||||
});
|
||||
};
|
20
node_modules/gulp-git/lib/updateSubmodule.js
generated
vendored
Normal file
20
node_modules/gulp-git/lib/updateSubmodule.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function(opt, cb) {
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git submodule update ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err && cb) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
if (cb) cb();
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue