New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cracks

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cracks - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

.npmrc

18

dist/cli.js

@@ -28,3 +28,3 @@ 'use strict';

exports['default'] = function (argv) {
var args = _minimist2['default'](argv, {
var args = (0, _minimist2['default'])(argv, {
string: ['paths'],

@@ -41,10 +41,12 @@ booleans: ['silent', 'help', 'version'],

if (args.version) return console.log(_packageJson2['default'].version);
_2['default']({
paths: args.paths ? _lodashArrayUniq2['default'](args.paths.split(/ *, */)) : null,
(0, _2['default'])({
paths: args.paths ? (0, _lodashArrayUniq2['default'])(args.paths.split(/ *, */)) : null,
silent: !!args.silent
}, function (err, ok) {
if (err) return console.error(err);
if (ok) return console.log('no breaking change detected');
console.log('breaking change detected');
process.exit(1);
}, function (err) {
if (err) {
console.error(err);
process.exit(1);
}
console.log('No undeclared Breaking Change.');
});

@@ -51,0 +53,0 @@ };

@@ -6,2 +6,3 @@ 'use strict';

});
var _arguments = arguments;

@@ -14,2 +15,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var _lodash = require('lodash');
var _gitRefs = require('git-refs');

@@ -19,31 +22,51 @@

exports['default'] = function (opts, callback) {
if (typeof opts === 'function') {
var _temp = [null, opts];
opts = _temp[0];
callback = _temp[1];
_temp;
exports['default'] = function () {
var callback = _arguments[_arguments.length - 1];
if (typeof callback !== 'function') {
throw new Error('No callback provied.');
}
opts = opts || {};
opts.paths = opts.paths || ['tests', 'package.json'];
if (opts.type === 'major') return callback(null, true);
_child_process.exec('git fetch --tags', function (error, stdout, stderr) {
if (error) return callback('could not fetch tags');
_child_process.exec('git describe --abbrev=0 --tags', function (descErr, stdout, stderr) {
_gitRefs2['default'](function (err, refs) {
if (err) return callback('could not get refs');
var opts = (0, _lodash.defaults)(_arguments.length > 1 && _arguments[0] || {}, {
silent: true,
paths: ['tests', 'package.json']
});
var _ref = _arguments.length > 2 && _arguments[1] || {};
var nextRelease = _ref.nextRelease;
if ((nextRelease.type || opts.type) === 'major') return callback(null);
(0, _child_process.exec)('git fetch --tags', function (error, stdout, stderr) {
if (error) return callback(new Error('Could not fetch tags.'));
(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.'));
var cohash = refs.get(descErr ? 'HEAD' : 'tags/' + stdout.trim());
_child_process.exec('git checkout ' + cohash + ' ' + opts.paths.join(' '), function (error, stdout, stderr) {
if (error) return callback('could not checkout paths');
var pkg = JSON.parse(_fs.readFileSync('package.json').toString());
(0, _child_process.exec)('git checkout ' + cohash + ' ' + opts.paths.join(' '), function (error, stdout, stderr) {
if (error) return callback(new Error('Could not checkout paths.'));
var pkg = JSON.parse((0, _fs.readFileSync)('package.json').toString());
var tmpDep = pkg.dependencies;
delete pkg.dependencies;
_fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
_child_process.exec('npm install', function (error, stdout, stderr) {
if (error) return callback('could not install dependencies');
(0, _fs.writeFileSync)('package.json', JSON.stringify(pkg, null, 2) + '\n');
(0, _child_process.exec)('npm install', function (error, stdout, stderr) {
if (error) return callback(new Error('Could not install dependencies.'));
pkg.dependencies = tmpDep;
_fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
var npmTest = _child_process.exec('npm test', function (error, stdout, stderr) {
_child_process.exec('git stash', function () {
callback(null, !error);
(0, _fs.writeFileSync)('package.json', JSON.stringify(pkg, null, 2) + '\n');
var npmTest = (0, _child_process.exec)('npm test', function (error, stdout, stderr) {
(0, _child_process.exec)('git stash', function () {
// Ignoring `git stash errors
if (error) {
if (opts.silent) {
// When things go wrong we log no matter what
console.error(stdout);
console.error(stderr);
}
return callback(new Error('Old tests failed. Breaking Change detected.'));
}
// Congratulations. No Breaking Change!
callback(null);
});

@@ -50,0 +73,0 @@ });

@@ -32,8 +32,10 @@ import minimist from 'minimist'

silent: !!args.silent
}, (err, ok) => {
if (err) return console.error(err)
if (ok) return console.log('no breaking change detected')
console.log('breaking change detected')
process.exit(1)
}, (err) => {
if (err) {
console.error(err)
process.exit(1)
}
console.log('No undeclared Breaking Change.')
})
}

@@ -1,20 +0,31 @@

import {exec, spawn} from 'child_process'
import {readFileSync, writeFileSync} from 'fs'
import { exec } from 'child_process'
import { readFileSync, writeFileSync } from 'fs'
import { defaults } from 'lodash'
import gitRefs from 'git-refs'
export default (opts, callback) => {
if (typeof opts === 'function') {
[opts, callback] = [null, opts]
export default () => {
const callback = arguments[arguments.length - 1]
if (typeof callback !== 'function') {
throw new Error('No callback provied.')
}
opts = opts || {}
opts.paths = opts.paths || ['tests', 'package.json']
if (opts.type === 'major') return callback(null, true)
const opts = defaults(arguments.length > 1 && arguments[0] || {}, {
silent: true,
paths: ['tests', 'package.json']
})
const { nextRelease } = arguments.length > 2 && arguments[1] || {}
if ((nextRelease.type || opts.type) === 'major') return callback(null)
exec('git fetch --tags', (error, stdout, stderr) => {
if (error) return callback('could not fetch tags')
if (error) return callback(new Error('Could not fetch tags.'))
exec('git describe --abbrev=0 --tags', (descErr, stdout, stderr) => {
gitRefs((err, refs) => {
if (err) return callback('could not get refs')
if (err) return callback(new Error('Could not get refs.'))
let cohash = refs.get(descErr ? 'HEAD' : `tags/${stdout.trim()}`)
exec(`git checkout ${cohash} ${opts.paths.join(' ')}`, (error, stdout, stderr) => {
if (error) return callback('could not checkout paths')
if (error) return callback(new Error('Could not checkout paths.'))
let pkg = JSON.parse(readFileSync('package.json').toString())

@@ -25,3 +36,3 @@ const tmpDep = pkg.dependencies

exec('npm install', (error, stdout, stderr) => {
if (error) return callback('could not install dependencies')
if (error) return callback(new Error('Could not install dependencies.'))
pkg.dependencies = tmpDep

@@ -31,3 +42,15 @@ writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n')

exec('git stash', () => {
callback(null, !error)
// Ignoring `git stash errors
if (error) {
if (opts.silent) {
// When things go wrong we log no matter what
console.error(stdout)
console.error(stderr)
}
return callback(new Error('Old tests failed. Breaking Change detected.'))
}
// Congratulations. No Breaking Change!
callback(null)
})

@@ -34,0 +57,0 @@ })

{
"name": "cracks",
"version": "2.0.1",
"description": "breaking change detection",

@@ -8,11 +7,11 @@ "main": "index.js",

"scripts": {
"clean": "rm -rf dist || true && mkdir dist",
"build": "npm run clean && babel lib --out-dir dist",
"prebuild": "rimraf dist && mkdirp dist",
"build": "babel lib --out-dir dist",
"test": "standard",
"prepublish": "npm run build && semantic-release pre",
"postpublish": "semantic-release post"
"prepublish": "npm run build",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
"type": "git",
"url": "git+https://github.com/christophwitzko/cracks.git"
"url": "https://github.com/semantic-release/cracks.git"
},

@@ -30,9 +29,11 @@ "keywords": [

"bugs": {
"url": "https://github.com/christophwitzko/cracks/issues"
"url": "https://github.com/semantic-release/cracks/issues"
},
"homepage": "https://github.com/christophwitzko/cracks#readme",
"homepage": "https://github.com/semantic-release/cracks#readme",
"devDependencies": {
"babel": "^5.2.17",
"semantic-release": "^3.2.2",
"standard": "^3.7.3"
"mkdirp": "^0.5.1",
"rimraf": "^2.4.2",
"semantic-release": "^4.0.0",
"standard": "^4.2.1"
},

@@ -48,3 +49,4 @@ "standard": {

"minimist": "^1.1.1"
}
},
"version": "3.0.0"
}
# cracks
[![Build Status](https://travis-ci.org/christophwitzko/cracks.svg)](https://travis-ci.org/christophwitzko/cracks)
[![Build Status](https://travis-ci.org/semantic-release/cracks.svg)](https://travis-ci.org/semantic-release/cracks)

@@ -4,0 +4,0 @@ ## Install

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