Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commitplease

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commitplease - npm Package Compare versions

Comparing version 0.5.2 to 0.5.3

33

install.js

@@ -31,25 +31,18 @@ // based on install.js by bahmutov

var name = "commit-msg";
var hook = path.resolve(hooks, "commit-msg");
var symlink = path.relative(path.resolve(hooks), "./commit-msg-hook.js");
console.log('installing hook', name);
var hook = path.resolve(hooks, name);
var hookContent = fs.readFileSync( "./commit-msg-hook.js" );
// If there's an existing `pre-commit` hook we want to back it up instead of
// overriding it and losing it completely
if (fs.existsSync(hook)) {
// Check for existing hook
if ( fs.existsSync( hook ) ) {
var stats = fs.lstat( hook );
if ( stats.isSymbolicLink() && fs.readlinkSync( hook ) === symlink ) {
console.log( "Found the correct existing symlink, doing nothing" );
process.exit(0);
}
console.log('Detected an existing git commit-msg hook');
console.log('');
console.log(name + ': Detected an existing git hook');
fs.writeFileSync(hook + '.old', fs.readFileSync(hook));
fs.unlinkSync(hook);
console.log(name + ': Old hook backuped to .old');
console.log('');
console.log('Remove it and install this package again to install the symlink');
process.exit(0);
}
// Everything is ready for the installation of the pre-commit hook. Write it and
// make it executable.
console.log(path.relative(path.resolve(hooks), "./commit-msg-hook.js"));
fs.symlinkSync(path.relative(path.resolve(hooks), "./commit-msg-hook.js"), hook);
// fs.writeFileSync(hook, hookContent);
// fs.chmodSync(hook, '755');
fs.symlinkSync(symlink, hook);
{
"name": "commitplease",
"version": "0.5.2",
"version": "0.5.3",
"description": "Validates strings as commit messages",

@@ -5,0 +5,0 @@ "main": "index.js",

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