Comparing version 3.0.2 to 3.1.0
@@ -39,9 +39,9 @@ 'use strict'; | ||
(0, _child_process.exec)('git fetch --tags', function (error, stdout, stderr) { | ||
if (error) return callback(new Error('Could not fetch tags.')); | ||
if (error) return callback(new Error('Could not fetch tags: `${stderr}`')); | ||
(0, _child_process.exec)('git describe --abbrev=0 --tags', function (descErr, stdout, stderr) { | ||
(0, _gitRefs2['default'])(function (err, refs) { | ||
if (err) return callback(new Error('Could not get refs.')); | ||
if (err) return callback(new Error('Could not get refs: `${stderr}`')); | ||
var cohash = refs.get(descErr ? 'HEAD' : 'tags/' + stdout.trim()); | ||
(0, _child_process.exec)('git checkout ' + cohash + ' ' + opts.paths.join(' '), function (error, stdout, stderr) { | ||
if (error) return callback(new Error('Could not checkout paths.')); | ||
if (error) return callback(new Error('Could not checkout paths: `${stderr}`')); | ||
var pkg = JSON.parse((0, _fs.readFileSync)('package.json').toString()); | ||
@@ -52,3 +52,3 @@ var tmpDep = pkg.dependencies; | ||
(0, _child_process.exec)('npm install', function (error, stdout, stderr) { | ||
if (error) return callback(new Error('Could not install dependencies.')); | ||
if (error) return callback(new Error('Could not install dependencies: `${stderr}`')); | ||
pkg.dependencies = tmpDep; | ||
@@ -55,0 +55,0 @@ (0, _fs.writeFileSync)('package.json', JSON.stringify(pkg, null, 2) + '\n'); |
@@ -25,9 +25,9 @@ import { exec } from 'child_process' | ||
exec('git fetch --tags', (error, stdout, stderr) => { | ||
if (error) return callback(new Error('Could not fetch tags.')) | ||
if (error) return callback(new Error('Could not fetch tags: `${stderr}`')) | ||
exec('git describe --abbrev=0 --tags', (descErr, stdout, stderr) => { | ||
gitRefs((err, refs) => { | ||
if (err) return callback(new Error('Could not get refs.')) | ||
if (err) return callback(new Error('Could not get refs: `${stderr}`')) | ||
let cohash = refs.get(descErr ? 'HEAD' : `tags/${stdout.trim()}`) | ||
exec(`git checkout ${cohash} ${opts.paths.join(' ')}`, (error, stdout, stderr) => { | ||
if (error) return callback(new Error('Could not checkout paths.')) | ||
if (error) return callback(new Error('Could not checkout paths: `${stderr}`')) | ||
let pkg = JSON.parse(readFileSync('package.json').toString()) | ||
@@ -38,3 +38,3 @@ const tmpDep = pkg.dependencies | ||
exec('npm install', (error, stdout, stderr) => { | ||
if (error) return callback(new Error('Could not install dependencies.')) | ||
if (error) return callback(new Error('Could not install dependencies: `${stderr}`')) | ||
pkg.dependencies = tmpDep | ||
@@ -41,0 +41,0 @@ writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n') |
@@ -48,3 +48,3 @@ { | ||
}, | ||
"version": "3.0.2" | ||
"version": "3.1.0" | ||
} |
# cracks | ||
[![Build Status](https://travis-ci.org/semantic-release/cracks.svg)](https://travis-ci.org/semantic-release/cracks) | ||
> This module can automatically detect breaking changes by running the | ||
test suite of your last-release against the current codebase. That shouldn't fail. | ||
_Note:_ This is under the assumption you're testing the API of your module rather than implementation details. Of course this is hard sometimes and you might get false positives. Better safe than sorry :) | ||
## Install | ||
$ npm install cracks -D | ||
```bash | ||
npm install --save-dev cracks | ||
``` | ||
## Configuration | ||
**paths**: An array of paths (files/directories) that will be checked out from the last release to restore your test suite. Note that you should add "package.json", because it will install old "devDependencies" as well. Default: `["tests", "package.json"]` | ||
**silent**: Whether to output the results of `npm test`. It will always output the results when a breaking change was detected. Default: `true` | ||
The test command is currently hard coded as `npm test`, but will be configurable in the future. | ||
## Usage | ||
### As a [`semantic-release`](https://github.com/semantic-release/semantic-release) plugin | ||
Add a "verifyRelease" plugin to the "release" field in your "package.json". | ||
```json | ||
"release": { | ||
"verifyRelease": "cracks" | ||
} | ||
``` | ||
Passing options: | ||
```json | ||
"release": { | ||
"verifyRelease": { | ||
"path": "cracks", | ||
"paths": ["tests", "package.json"], | ||
"silent": true | ||
} | ||
} | ||
``` | ||
### CLI | ||
``` | ||
Usage: | ||
crack <options> | ||
Options: | ||
-p, --paths <paths> Overwrite checkout paths | ||
-s, --silent Suppress 'npm test' output | ||
-v, --version Output the current version | ||
-h, --help Output this help info | ||
``` | ||
## Licence | ||
@@ -9,0 +60,0 @@ |
11482
64
10