simple-git
Advanced tools
Comparing version 1.5.0 to 1.6.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -14,4 +14,6 @@ "contributors": [ | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"grunt-release-steps": "~0.3.7", | ||
"grunt": "~0.4.1" | ||
"nodeunit": "^0.9.1", | ||
"sinon": "^1.15.4" | ||
}, | ||
@@ -24,5 +26,7 @@ "keywords": [ | ||
"repository": "git://github.com/steveukx/git-js.git", | ||
"main": "src/git.js", | ||
"main": "src/index.js", | ||
"bin": {}, | ||
"scripts": {}, | ||
"scripts": { | ||
"test": "node node_modules/nodeunit/bin/nodeunit" | ||
}, | ||
"config": {}, | ||
@@ -29,0 +33,0 @@ "engines": { |
(function () { | ||
var ChildProcess = require('child_process'); | ||
var Buffer = require('buffer').Buffer; | ||
/** | ||
* Git handling for node. All public functions can be chained and all `then` handlers are optional. | ||
* | ||
* @param {String} baseDir | ||
* @param {String} baseDir base directory for all processes to run | ||
* | ||
* @param {Function} ChildProcess The ChildProcess constructor to use | ||
* @param {Function} Buffer The Buffer implementation to use | ||
* | ||
* @constructor | ||
*/ | ||
function Git (baseDir) { | ||
function Git (baseDir, ChildProcess, Buffer) { | ||
this._baseDir = baseDir; | ||
this._runCache = []; | ||
this.ChildProcess = ChildProcess; | ||
this.Buffer = Buffer; | ||
} | ||
@@ -139,5 +143,3 @@ | ||
files = files ? ' "' + [].concat(files).join('" "') + '"' : ''; | ||
return this._run(['commit', '-m', message].concat(files), function (err, data) { | ||
return this._run(['commit', '-m', message].concat([].concat(files || [])), function (err, data) { | ||
then && then(err, !err && git._parseCommit(data)); | ||
@@ -235,7 +237,7 @@ }); | ||
* | ||
* @param {String} [name] | ||
* @param {String} name | ||
* @param {Function} [then] | ||
*/ | ||
Git.prototype.addTag = function (name, then) { | ||
return this._run(['tag', name], function (err, data) { | ||
return this._run(['tag', name], function (err) { | ||
then && then(err); | ||
@@ -680,2 +682,3 @@ }); | ||
if (!this._childProcess && this._runCache.length) { | ||
var Buffer = this.Buffer; | ||
var task = this._runCache.shift(); | ||
@@ -687,3 +690,3 @@ var command = task[0]; | ||
var stdErr = []; | ||
var spawned = ChildProcess.spawn(this._command, command.slice(0), { | ||
var spawned = this.ChildProcess.spawn(this._command, command.slice(0), { | ||
cwd: this._baseDir | ||
@@ -722,6 +725,4 @@ }); | ||
module.exports = function (baseDir) { | ||
return new Git(baseDir || process.cwd()); | ||
}; | ||
module.exports = Git; | ||
}()); |
15
test.js
require('./src/git')() | ||
require('./')() | ||
//.outputHandler(function (action, stdOut, stdErr) { | ||
@@ -14,14 +14,5 @@ // console.log("Running git-" + action); | ||
//}) | ||
.pushTags(function (err) { | ||
console.log('pushTags', err); | ||
}) | ||
.then(function () { | ||
console.log('then-a'); | ||
}) | ||
.status(function (a, b) { | ||
console.log('status', a, b); | ||
}) | ||
.then(function () { | ||
console.log('then-b'); | ||
.addTag('tagged', function (err, data) { | ||
console.log('addTag', err, data); | ||
}); | ||
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
35120
8
785
1
4