commitplease
Advanced tools
Comparing version 2.2.2 to 2.2.3
#!/usr/bin/env node | ||
// commitplease-original | ||
require( "commitplease" )( process.argv[ 2 ] ); |
@@ -17,3 +17,3 @@ var fs = require( "fs" ), | ||
console.error(); | ||
console.error( "Commit message was:"); | ||
console.error( "Commit message was:" ); | ||
console.error(); | ||
@@ -20,0 +20,0 @@ console.error( chalk.green( message ) ); |
@@ -11,3 +11,3 @@ var chalk = require( "chalk" ), | ||
console.log( chalk.red( "Remove it and install this package again to install commitplease properly" ) ); | ||
process.exit(0); | ||
process.exit( 0 ); | ||
} | ||
@@ -14,0 +14,0 @@ |
var scissor = /# ------------------------ >8 ------------------------[\s\S]+/; | ||
module.exports = function( value ) { | ||
return value.replace( scissor, "" ).split( /\n/ ).filter(function( line ) { | ||
return value.replace( scissor, "" ).split( /\n/ ).filter( function( line ) { | ||
return !/^#/.test( line ); | ||
}).join( "\n").trim(); | ||
} ).join( "\n" ).trim(); | ||
}; |
var merge = require( "mout/object/merge" ), | ||
semver = require( "semver"), | ||
semver = require( "semver" ), | ||
subjectExceptions = /^(fixup|squash)!|^\[[^\]]+\]:/, | ||
@@ -19,4 +19,5 @@ defaults = { | ||
// Can't cancel forEach, so abuse every to stop at first comment | ||
message.split( /\n/ ).every(function( line, index ) { | ||
message.split( /\n/ ).every( function( line, index ) { | ||
if ( index === 0 ) { | ||
// Allow tag commits | ||
@@ -26,2 +27,3 @@ if ( semver.valid( line ) ) { | ||
} | ||
// Allow merge commits | ||
@@ -63,2 +65,3 @@ if ( /^Merge branch/.test( line ) || /^Merge [0-9a-f]+ into [0-9a-f]+/.test( line ) ) { | ||
} | ||
// Ticket references | ||
@@ -73,5 +76,5 @@ if ( index > 0 && /^(clos|fix|resolv)(e[sd]|ing)/i.test( line ) ) { | ||
return true; | ||
}); | ||
} ); | ||
return errors; | ||
}; |
{ | ||
"name": "commitplease", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Validates strings as commit messages", | ||
@@ -26,11 +26,11 @@ "main": "index.js", | ||
"devDependencies": { | ||
"nodeunit": "0.8.2", | ||
"jshint": "2.5.6", | ||
"jscs": "1.7.3" | ||
"nodeunit": "^0.9.1", | ||
"jshint": "^2.8.0", | ||
"jscs": "^1.13.1" | ||
}, | ||
"dependencies": { | ||
"chalk": "0.4.0", | ||
"mout": "0.8.0", | ||
"semver": "2.2.1" | ||
"chalk": "^1.1.0", | ||
"mout": "^0.11.0", | ||
"semver": "^5.0.1" | ||
} | ||
} |
48
setup.js
@@ -1,33 +0,33 @@ | ||
(function avoidSelfInstall() { | ||
var pkg = require("./package"), | ||
nameRegex = new RegExp("node_modules/" + pkg.name + "$"); | ||
if (!nameRegex.test(process.cwd().replace(/\\/g, "/"))) { | ||
console.log("running install inside self, no need"); | ||
process.exit(0); | ||
( function avoidSelfInstall() { | ||
var pkg = require( "./package" ), | ||
nameRegex = new RegExp( "node_modules/" + pkg.name + "$" ); | ||
if ( !nameRegex.test( process.cwd().replace( /\\/g, "/" ) ) ) { | ||
console.log( "running install inside self, no need" ); | ||
process.exit( 0 ); | ||
} | ||
}()); | ||
}() ); | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
var root = path.resolve(__dirname, "../.."); | ||
var git = path.resolve(root, ".git"); | ||
var hooks = path.resolve(git, "hooks"); | ||
var path = require( "path" ); | ||
var fs = require( "fs" ); | ||
var root = path.resolve( __dirname, "../.." ); | ||
var git = path.resolve( root, ".git" ); | ||
var hooks = path.resolve( git, "hooks" ); | ||
var rootPackage = require(path.resolve(root, "package")); | ||
if (rootPackage.commitplease && rootPackage.commitplease.nohook) { | ||
console.error("package.json indicates to skip hook"); | ||
process.exit(0); | ||
var rootPackage = require( path.resolve( root, "package" ) ); | ||
if ( rootPackage.commitplease && rootPackage.commitplease.nohook ) { | ||
console.error( "package.json indicates to skip hook" ); | ||
process.exit( 0 ); | ||
} | ||
// Check if we are in a git repository so we can bail out early when this is not the case. | ||
if (!fs.existsSync(git) || !fs.lstatSync(git).isDirectory()) { | ||
console.error("Could not find git repo in " + git); | ||
process.exit(0); | ||
if ( !fs.existsSync( git ) || !fs.lstatSync( git ).isDirectory() ) { | ||
console.error( "Could not find git repo in " + git ); | ||
process.exit( 0 ); | ||
} | ||
if (!fs.existsSync(hooks)) { | ||
fs.mkdirSync(hooks); | ||
if ( !fs.existsSync( hooks ) ) { | ||
fs.mkdirSync( hooks ); | ||
} | ||
var hook = path.resolve(hooks, "commit-msg"); | ||
var hook = path.resolve( hooks, "commit-msg" ); | ||
var hookFile = path.relative( path.resolve( hooks ), "./commit-msg-hook.js" ); | ||
@@ -41,4 +41,4 @@ | ||
fs.chmodSync( hook, "755" ); | ||
} catch (e) { | ||
if (/EPERM/.test(e.message)) { | ||
} catch ( e ) { | ||
if ( /EPERM/.test( e.message ) ) { | ||
console.error( "Failed to write commit-msg hook. " + | ||
@@ -45,0 +45,0 @@ "Make sure you have the necessary permissions." ); |
@@ -187,6 +187,6 @@ var validate = require( "./lib/validate" ), | ||
exports.valid = function( test ) { | ||
valid.forEach(function(check, index) { | ||
valid.forEach( function( check, index ) { | ||
test.deepEqual( validate( sanitize( check.msg ), check.options ), [], "valid " + index + | ||
" " + check.msg ); | ||
}); | ||
} ); | ||
test.done(); | ||
@@ -196,6 +196,6 @@ }; | ||
exports.invalid = function( test ) { | ||
invalid.forEach(function(check, index) { | ||
invalid.forEach( function( check, index ) { | ||
test.deepEqual( validate( sanitize( check.msg ), check.options ), check.expected, | ||
"invalid " + index + " " + check.msg ); | ||
}); | ||
} ); | ||
test.done(); | ||
@@ -202,0 +202,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
15758
16
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedmout@0.11.1(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
- Removedansi-styles@1.0.0(transitive)
- Removedchalk@0.4.0(transitive)
- Removedhas-color@0.1.7(transitive)
- Removedmout@0.8.0(transitive)
- Removedsemver@2.2.1(transitive)
- Removedstrip-ansi@0.1.1(transitive)
Updatedchalk@^1.1.0
Updatedmout@^0.11.0
Updatedsemver@^5.0.1