staged-git-files
Advanced tools
+12
| 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 |
+5
-0
| # 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 @@ |
+23
-4
| 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; |
+1
-1
| { | ||
| "name": "staged-git-files", | ||
| "version": "1.1.2", | ||
| "version": "1.2.0", | ||
| "devDependencies": { | ||
@@ -5,0 +5,0 @@ "should": "~2.0.1", |
+14
-0
@@ -5,2 +5,4 @@ # Staged Git Files | ||
| [](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 @@ |
+34
-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) { |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
25402
10.16%10
11.11%598
8.33%112
14.29%8
14.29%