Socket
Socket
Sign inDemoInstall

git-commit-file

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-commit-file - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

yarn.lock

5

bin/gitCommitFile.js

@@ -5,2 +5,3 @@ #!/usr/bin/env node

const main = require('../index')
const args = yargs.argv._

@@ -13,6 +14,4 @@ let arg

console.log('GLOBAL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
console.log(process.env)
console.log('GLOBAL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
process.env.NODE_IS_GLOBAL = true
main(arg)

60

js/gcf.spec.js
const chai = require('chai')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
const expect = chai.expect
chai.use(sinonChai)
const expect = chai.expect
const {name} = require('../package.json')
const helper = require('./helper')
const gcf = require('./gcf')
const helper = require('./helper')
const {name} = require('../package.json')

@@ -22,2 +22,3 @@ describe(name, () => {

beforeEach(function() {
delete process.env.NODE_IS_GLOBAL
sandbox = sinon.sandbox.create()

@@ -35,2 +36,11 @@ greenSpy = sandbox.spy(helper, 'green')

const checkSuccessExpectations = (filename, exitCode) => {
expect(addStub).to.have.been.calledWith(filename)
expect(commitStub).to.have.been.calledWith(filename)
expect(greenSpy).to.have.been.calledWith(`Committed ${filename}`)
expect(exitCode).to.equal(0)
}
it('exits with 0 when filename given', () => {

@@ -41,9 +51,14 @@

const exitCode = gcf(filename)
checkSuccessExpectations(filename, exitCode)
expect(webpackStub).to.have.not.been.called
})
it('exits with 0 when filename given and node is global', () => {
process.env.NODE_IS_GLOBAL = true
const filename = 'myFile'
initStubs({})
const exitCode = gcf(filename)
checkSuccessExpectations(filename, exitCode)
expect(webpackStub).to.have.not.been.called
expect(addStub).to.have.been.calledWith(filename)
expect(commitStub).to.have.been.calledWith(filename)
expect(greenSpy).to.have.been.calledWith('Committed ' + filename)
expect(exitCode).to.equal(0)
})

@@ -56,9 +71,4 @@

const exitCode = gcf()
checkSuccessExpectations(filename, exitCode)
expect(webpackStub).to.have.been.called
expect(addStub).to.have.been.calledWith(filename)
expect(commitStub).to.have.been.calledWith(filename)
expect(greenSpy).to.have.been.calledWith(`Committed ${filename}`)
expect(exitCode).to.equal(0)
})

@@ -69,8 +79,4 @@ })

it('exits with 1 and warning when git add exits with code 1', () => {
const checkWarningExpectations = (filename, exitCode) => {
const filename = 'myFile'
initStubs({add: {code: 1}})
const exitCode = gcf(filename)
expect(webpackStub).to.have.not.been.called

@@ -82,2 +88,10 @@ expect(addStub).to.have.been.calledWith(filename)

expect(exitCode).to.equal(1)
}
it('exits with 1 and warning when git add exits with code 1', () => {
const filename = 'myFile'
initStubs({add: {code: 1}})
const exitCode = gcf(filename)
checkWarningExpectations(filename, exitCode)
})

@@ -90,9 +104,3 @@

const exitCode = gcf(filename)
expect(webpackStub).to.have.not.been.called
expect(addStub).to.have.been.calledWith(filename)
expect(commitStub).to.have.been.calledWith(filename)
expect(yellowSpy).to.have.been.calledWith(`Did not commit ${filename}`)
expect(exitCode).to.equal(1)
checkWarningExpectations(filename, exitCode)
})

@@ -99,0 +107,0 @@ })

@@ -31,5 +31,7 @@ const chalk = require('chalk')

/* istanbul ignore else */
if (testing) return exitCode
/* istanbul ignore next */
process.exit(exitCode)
if (process.env.NODE_IS_GLOBAL !== 'true' || testing) {
return exitCode
} else {
process.exit(exitCode)
}
},

@@ -36,0 +38,0 @@

{
"name": "git-commit-file",
"version": "1.0.7",
"description": "Git commit a single file in a single command",
"version": "1.0.8",
"description": "Git add and commit a single file in a single command",
"author": "danday74",

@@ -34,3 +34,22 @@ "license": "ISC",

},
"keywords": [],
"keywords": [
"git",
"add",
"commit",
"file",
"command",
"one",
"single",
"local",
"global",
"webpack",
"config",
"output",
"filename",
"webpack.config.output.filename",
"webpack.config.output",
"webpack.output.filename",
"webpack.output",
"output.filename"
],
"repository": {

@@ -37,0 +56,0 @@ "type": "git",

@@ -9,2 +9,2 @@ # git-commit-file

**Git commit a single file in a single command**
**Git add and commit a single file in a single command**

@@ -1,2 +0,1 @@

tidy code
write README / test externally (global and local)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc