Socket
Socket
Sign inDemoInstall

husky

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

husky - npm Package Compare versions

Comparing version 5.1.3 to 5.2.0

lib/commands/set_add.js

21

lib/bin.js

@@ -7,8 +7,8 @@ #!/usr/bin/env node

Object.defineProperty(exports, "__esModule", { value: true });
const add_1 = require("./commands/add");
const install_1 = require("./commands/install");
const uninstall_1 = require("./commands/uninstall");
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const init_1 = require("./commands/init");
const install_1 = require("./commands/install");
const set_add_1 = require("./commands/set_add");
const uninstall_1 = require("./commands/uninstall");
function readPkg() {

@@ -28,2 +28,3 @@ return JSON.parse(fs_1.default.readFileSync(path_1.default.join(__dirname, '../package.json'), 'utf-8'));

husky uninstall
husky set <file> [cmd]
husky add <file> [cmd]

@@ -37,2 +38,6 @@

husky set .husky/pre-commit
husky set .husky/pre-commit "npm test"
husky set .config/husky/pre-commit "npm test"
husky add .husky/pre-commit

@@ -61,2 +66,10 @@ husky add .husky/pre-commit "npm test"

}
case 'set': {
if (args.length === 0 || args.length > 2) {
help();
process.exit(2);
}
set_add_1.set(args[0], args[1]);
break;
}
case 'add': {

@@ -67,3 +80,3 @@ if (args.length === 0 || args.length > 2) {

}
add_1.add(args[0], args[1]);
set_add_1.add(args[0], args[1]);
break;

@@ -70,0 +83,0 @@ }

7

lib/commands/init.js

@@ -8,4 +8,5 @@ "use strict";

const fs_1 = __importDefault(require("fs"));
const add_1 = require("./add");
const log_1 = require("../log");
const install_1 = require("./install");
const set_add_1 = require("./set_add");
const regex = /^[ ]+|\t+/m;

@@ -32,6 +33,6 @@ function init(isYarn2) {

fs_1.default.writeFileSync('package.json', `${JSON.stringify(pkg, null, indent)}\n`);
console.log('husky - updated package.json');
log_1.l('updated package.json');
install_1.install();
add_1.add('.husky/pre-commit', 'npm test');
set_add_1.set('.husky/pre-commit', 'npm test');
}
exports.init = init;

@@ -7,8 +7,10 @@ "use strict";

exports.install = void 0;
const child_process_1 = __importDefault(require("child_process"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const child_process_1 = __importDefault(require("child_process"));
const log_1 = require("../log");
const customDirHelp = 'https://typicode.github.io/husky/#/?id=custom-directory';
function install(dir = '.husky') {
if (child_process_1.default.spawnSync('git', ['rev-parse']).status !== 0) {
console.log('husky - not a Git repository, skipping hooks installation');
log_1.l('not a Git repository, skipping hooks installation');
return;

@@ -18,6 +20,6 @@ }

if (!absoluteHooksDir.startsWith(process.cwd())) {
throw new Error('.. not allowed');
throw new Error(`.. not allowed (see ${customDirHelp})`);
}
if (!fs_1.default.existsSync('.git')) {
throw new Error(".git can't be found");
throw new Error(`.git can't be found (see ${customDirHelp})`);
}

@@ -34,7 +36,7 @@ try {

catch (e) {
console.log('husky - Git hooks failed to install');
log_1.l('Git hooks failed to install');
throw e;
}
console.log('husky - Git hooks installed');
log_1.l('Git hooks installed');
}
exports.install = install;
{
"name": "husky",
"version": "5.1.3",
"version": "5.2.0",
"description": "Git hooks made easy",

@@ -22,11 +22,5 @@ "bin": {

"@types/node": "^14.14.25",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"@typicode/eslint-config": "^0.1.2",
"del-cli": "^3.0.1",
"docsify-cli": "^4.4.2",
"eslint": "^7.19.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1",
"pinst": "^2.1.4",
"prettier": "^2.2.1",
"type-fest": "^0.21.2",

@@ -42,10 +36,6 @@ "typescript": "^4.1.3"

"preuninstall": "node lib/bin uninstall",
"prepack": "pinst --disable",
"postpack": "pinst --enable",
"preversion": "npm run build",
"postversion": "git push && git push --tags && npm publish",
"prepublishOnly": "pinst --disable",
"postpublish": "pinst --enable",
"pretest": "npm run build --silent && npm pack --silent",
"test": "sh ./test/init.sh && sh ./test/init-yarn-2.sh && sh ./test/default.sh && sh ./test/sub-dir.sh && sh ./test/config-dir.sh && sh ./test/not-git-dir.sh",
"test": "sh ./test/init.sh && sh ./test/init-yarn-2.sh && sh ./test/default.sh && sh ./test/sub-dir.sh && sh ./test/config-dir.sh && sh ./test/not-git-dir.sh && sh ./test/set-add.sh",
"posttest": "rm husky-*.tgz",

@@ -52,0 +42,0 @@ "commit": "commit"

@@ -14,2 +14,4 @@ # husky

__Note: husky 5 is a major version with breaking changes. Upgrading from v4 to v5 requires additional steps, please see the docs.__
---

@@ -16,0 +18,0 @@

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