Comparing version 1.0.2 to 2.0.0
@@ -43,5 +43,5 @@ 'use strict'; | ||
silent: !!args.silent | ||
}, function (err, bc) { | ||
}, function (err, ok) { | ||
if (err) return console.error(err); | ||
if (!bc) return console.log('no breaking change detected'); | ||
if (ok) return console.log('no breaking change detected'); | ||
console.log('breaking change detected'); | ||
@@ -48,0 +48,0 @@ process.exit(1); |
@@ -44,3 +44,3 @@ 'use strict'; | ||
_child_process.exec('git stash', function () { | ||
callback(null, !!error); | ||
callback(null, !error); | ||
}); | ||
@@ -47,0 +47,0 @@ }); |
@@ -16,3 +16,3 @@ import minimist from 'minimist' | ||
export default function (argv) { | ||
export default (argv) => { | ||
const args = minimist(argv, { | ||
@@ -33,5 +33,5 @@ string: ['paths'], | ||
silent: !!args.silent | ||
}, (err, bc) => { | ||
}, (err, ok) => { | ||
if (err) return console.error(err) | ||
if (!bc) return console.log('no breaking change detected') | ||
if (ok) return console.log('no breaking change detected') | ||
console.log('breaking change detected') | ||
@@ -38,0 +38,0 @@ process.exit(1) |
@@ -5,3 +5,3 @@ import {exec, spawn} from 'child_process' | ||
export default function (opts, callback) { | ||
export default (opts, callback) => { | ||
if (typeof opts === 'function') { | ||
@@ -12,9 +12,9 @@ [opts, callback] = [null, opts] | ||
opts.paths = opts.paths || ['tests', 'package.json'] | ||
exec('git fetch --tags', function (error, stdout, stderr) { | ||
exec('git fetch --tags', (error, stdout, stderr) => { | ||
if (error) return callback('could not fetch tags') | ||
exec('git describe --abbrev=0 --tags', function (descErr, stdout, stderr) { | ||
exec('git describe --abbrev=0 --tags', (descErr, stdout, stderr) => { | ||
gitRefs((err, refs) => { | ||
if (err) return callback('could not get refs') | ||
let cohash = refs.get(descErr ? 'HEAD' : `tags/${stdout.trim()}`) | ||
exec(`git checkout ${cohash} ${opts.paths.join(' ')}`, function (error, stdout, stderr) { | ||
exec(`git checkout ${cohash} ${opts.paths.join(' ')}`, (error, stdout, stderr) => { | ||
if (error) return callback('could not checkout paths') | ||
@@ -25,9 +25,9 @@ let pkg = JSON.parse(readFileSync('package.json').toString()) | ||
writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n') | ||
exec('npm install', function (error, stdout, stderr) { | ||
exec('npm install', (error, stdout, stderr) => { | ||
if (error) return callback('could not install dependencies') | ||
pkg.dependencies = tmpDep | ||
writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n') | ||
const npmTest = exec('npm test', function (error, stdout, stderr) { | ||
const npmTest = exec('npm test', (error, stdout, stderr) => { | ||
exec('git stash', () => { | ||
callback(null, !!error) | ||
callback(null, !error) | ||
}) | ||
@@ -34,0 +34,0 @@ }) |
{ | ||
"name": "cracks", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "breaking change detection", | ||
@@ -34,3 +34,3 @@ "main": "index.js", | ||
"babel": "^5.2.17", | ||
"semantic-release": "^3.2.1", | ||
"semantic-release": "^3.2.2", | ||
"standard": "^3.7.3" | ||
@@ -37,0 +37,0 @@ }, |
9664