Socket
Socket
Sign inDemoInstall

husky

Package Overview
Dependencies
0
Maintainers
1
Versions
207
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.7 to 5.0.8

27

lib/commands/install.js

@@ -7,9 +7,5 @@ "use strict";

exports.install = void 0;
const os_1 = __importDefault(require("os"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const child_process_1 = __importDefault(require("child_process"));
function copyScript(scriptName, destDir) {
fs_1.default.copyFileSync(path_1.default.join(__dirname, '../../scripts', scriptName), path_1.default.join(destDir, scriptName));
}
function install(dir = '.husky') {

@@ -23,15 +19,14 @@ const absoluteHooksDir = path_1.default.resolve(process.cwd(), dir);

}
const tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'husky-'));
copyScript('husky.sh', tmpDir);
copyScript('pre-commit', tmpDir);
fs_1.default.chmodSync(path_1.default.join(tmpDir, 'pre-commit'), 0o0755);
child_process_1.default.spawnSync('git', ['config', 'core.hooksPath', tmpDir]);
child_process_1.default.spawnSync('git', ['commit', '--author', 'husky <husky@example.com>'], {
stdio: 'inherit',
env: {
...process.env,
husky_dir: dir,
},
});
try {
fs_1.default.mkdirSync(path_1.default.join(dir, '_'), { recursive: true });
fs_1.default.writeFileSync(path_1.default.join(dir, '.gitignore'), '_', 'utf-8');
fs_1.default.copyFileSync(path_1.default.join(__dirname, '../../scripts/husky.sh'), path_1.default.join(dir, '_/husky.sh'));
child_process_1.default.spawnSync('git', ['config', 'core.hooksPath', dir]);
}
catch (e) {
console.log('husky - Git hooks failed to install');
throw e;
}
console.log('husky - Git hooks installed');
}
exports.install = install;
{
"name": "husky",
"version": "5.0.7",
"version": "5.0.8",
"description": "Git hooks made easy",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc