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

jira-precommit-hook

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jira-precommit-hook - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

21

lib/fs-utils.js

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

exports.copyHookFiles = copyHookFiles;
exports.getFilePath = getFilePath;
exports.readJSON = readJSON;

@@ -72,22 +71,2 @@

function getFilePath(startDir, desiredFileName) {
var currentDir = startDir;
while (_fs2['default'].existsSync(currentDir)) {
if (_fs2['default'].existsSync(_path2['default'].join(currentDir, desiredFileName))) {
currentDir = _path2['default'].join(currentDir, desiredFileName);
break;
} else {
var tempPath = currentDir;
currentDir = _path2['default'].normalize(_path2['default'].join(currentDir, '/..'));
if (currentDir === tempPath) {
throw new Error('Cannot find ' + desiredFileName);
}
}
}
return currentDir;
}
function readJSON(filePath) {

@@ -94,0 +73,0 @@ return _fsPromise2['default'].readFile(filePath).then(function (content) {

47

lib/install.js
'use strict';
var _Promise = require('babel-runtime/core-js/promise')['default'];
var _interopRequireDefault = require('babel-runtime/helpers/interop-require-default')['default'];
// eslint-disable-line no-process-exit
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = install;

@@ -13,28 +18,28 @@ var _fsUtilsJs = require('./fs-utils.js');

if (process.env.TEAMCITY_VERSION) {
console.log('TeamCity Detected not installing the commit hook');
process.exit(0);
}
function install() {
var thisProjectsGitFolder = _path2['default'].resolve(_path2['default'].join(__dirname, '../.git'));
var gitPath = (0, _fsUtilsJs.findParentFolder)(__dirname, '.git');
var currentPath = process.cwd();
if (thisProjectsGitFolder === gitPath) {
return _Promise.resolve(0);
}
var gitPath = undefined;
console.log('Installing JIRA pre-commit hook....');
console.log('Installing JIRA pre-commit hook....');
try {
gitPath = (0, _fsUtilsJs.findParentFolder)(__dirname, '.git');
} catch (error) {
return _Promise.reject('Your project needs a git repository to install the hook.');
}
try {
gitPath = (0, _fsUtilsJs.findParentFolder)(currentPath, '.git');
} catch (error) {
console.error('Your project needs a git repository to install the hook.');
}
console.log('Found .git directory at: ' + gitPath);
console.log('Found .git directory at: ' + gitPath);
var hooksPath = _path2['default'].join(gitPath, 'hooks');
(0, _fsUtilsJs.verifyHooksFolder)(hooksPath);
var hooksPath = _path2['default'].join(gitPath, 'hooks');
(0, _fsUtilsJs.verifyHooksFolder)(hooksPath);
return (0, _fsUtilsJs.copyHookFiles)(gitPath).then(function () {
return console.log('Copied commit hook.');
});
}
(0, _fsUtilsJs.copyHookFiles)(gitPath).then(function () {
return console.log('Copied commit hook.');
})['catch'](function (error) {
return console.error(error);
});
module.exports = exports['default'];

@@ -60,3 +60,3 @@ /* eslint no-process-exit:0 */

try {
jiraConfigPath = fsUtils.getFilePath(process.cwd(), '.jirarc');
jiraConfigPath = fsUtils.findParentFolder(process.cwd(), '.jirarc');
} catch (err) {

@@ -63,0 +63,0 @@ return _Promise.reject(new Error('.jirarc file is not found. Please refer to the readme for details about the .jirarc file'));

{
"name": "jira-precommit-hook",
"version": "1.1.2",
"version": "1.1.3",
"description": "Git commit hook to verify commit messages are tagged with a JIRA issue number",

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

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