You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

staged-git-files

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

staged-git-files - npm Package Compare versions

Comparing version
1.1.2
to
1.2.0
+12
.travis.yml
sudo: false
language: node_js
node_js:
- '4'
- '5'
- '6'
- '7'
- '8'
- '9'
- '10'
+11
-20

@@ -1,22 +0,13 @@

version: 2
version: 2 # use CircleCI 2.0
jobs:
build:
docker:
build:
docker:
- image: circleci/node:7.10
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: git config --global user.email "1551510+mcwhittemore@users.noreply.github.com"
- run: git config --global user.name "test staged-git-files"
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm test
steps: # a collection of executable commands
- checkout # special step to check out source code to working directory
- run:
name: install-npm-wee
command: npm install
- run: # run tests
name: test
command: npm test
# Change Log
## 1.2.0
- Adds promise support [#20](https://github.com/mcwhittemore/staged-git-files/pull/20) by [mreinstein](https://github.com/mreinstein)
- Adds travis config to enable CI [#20](https://github.com/mcwhittemore/staged-git-files/pull/20) by [mreinstein](https://github.com/mreinstein)
## 1.1.1

@@ -4,0 +9,0 @@

var spawn = require("child_process").spawn;
var fs = require("fs");
var sgf = function(filter, callback) {
if (typeof filter == "function") {
var sgf = function (filter, callback) {
if (typeof filter === 'function') {
callback = filter;
filter = "ACDMRTUXB";
filter = undefined;
}
if (typeof callback === 'undefined') {
return new Promise(function (resolve, reject) {
_sgf(filter, function (err, head) {
if (err)
return reject(err);
resolve(head);
});
});
} else {
_sgf(filter, callback);
}
};
function _sgf (filter, callback) {
if (typeof filter === 'undefined')
filter = 'ACDMRTUXB';
sgf.getHead(function(err, head) {

@@ -32,4 +50,5 @@ if (err) {

});
}
};
sgf.cwd = process.cwd();

@@ -36,0 +55,0 @@ sgf.debug = false;

{
"name": "staged-git-files",
"version": "1.1.2",
"version": "1.2.0",
"devDependencies": {

@@ -5,0 +5,0 @@ "should": "~2.0.1",

@@ -5,2 +5,4 @@ # Staged Git Files

[![Build Status](https://travis-ci.org/mcwhittemore/staged-git-files.svg?branch=master)](https://travis-ci.org/mcwhittemore/staged-git-files)
## Usage

@@ -57,2 +59,14 @@

If you omit a callback `sgf` will return a promise. How to use with `async`/`await`:
```javascript
async function main () {
const stagedFiles = await sgf();
}
main();
```
### sgf.getHead(callback)

@@ -59,0 +73,0 @@

@@ -204,2 +204,36 @@

it("if no callback is passed, I should return a promise and resolve the status of staged files", function(done) {
addFile(function(err, data) {
var sgf = newSGF();
sgf().then(function(results) {
results[0].filename.should.equal(data.filename);
results[0].status.should.equal("Added");
done();
}).catch(done);
});
});
it("if no callback is passed but a filter is passed, I should return a promise and resolve the status of staged files", function(done) {
addAndCommitFile(function(err, data) {
if (err) {
done(err);
} else {
var newFileName = randomFileName([8, 3]);
moveFile({
oldFileName: data.filename,
newFileName: newFileName
}, function(err) {
var sgf = newSGF();
sgf('A').then(function(results) {
results.length.should.equal(1);
results[0].filename.should.equal(newFileName);
results[0].status.should.equal("Added");
done();
}).catch(done);
});
}
});
});
it("readFile will aysnc read a file and return its content", function(done) {

@@ -206,0 +240,0 @@ addFile(function(err, data) {