-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(deps): bump husky from 8.0.3 to 9.0.6 #1689
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependabot
bot
added
dependencies
Pull requests that update a dependency file
javascript
Pull requests that update Javascript code
labels
Jan 29, 2024
Diff between husky 8.0.3 and 9.0.6diff --git a/lib/bin.js b/lib/bin.js
deleted file mode 100644
index v8.0.3..v9.0.6
--- a/lib/bin.js
+++ b/lib/bin.js
@@ -1,30 +0,0 @@
-#!/usr/bin/env node
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const p = require("path");
-const h = require("./");
-function help(code) {
- console.log(`Usage:
- husky install [dir] (default: .husky)
- husky uninstall
- husky set|add <file> [cmd]`);
- process.exit(code);
-}
-const [, , cmd, ...args] = process.argv;
-const ln = args.length;
-const [x, y] = args;
-const hook = (fn) => () => !ln || ln > 2 ? help(2) : fn(x, y);
-const cmds = {
- install: () => (ln > 1 ? help(2) : h.install(x)),
- uninstall: h.uninstall,
- set: hook(h.set),
- add: hook(h.add),
- ['-v']: () => console.log(require(p.join(__dirname, '../package.json')).version),
-};
-try {
- cmds[cmd] ? cmds[cmd]() : help(0);
-}
-catch (e) {
- console.error(e instanceof Error ? `husky - ${e.message}` : e);
- process.exit(1);
-}
\ No newline at end of file
diff --git a/lib/index.js b/lib/index.js
deleted file mode 100644
index v8.0.3..v9.0.6
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,67 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.uninstall = exports.add = exports.set = exports.install = void 0;
-const cp = require("child_process");
-const fs = require("fs");
-const p = require("path");
-const l = (msg) => console.log(`husky - ${msg}`);
-const git = (args) => cp.spawnSync('git', args, { stdio: 'inherit' });
-function install(dir = '.husky') {
- if (process.env.HUSKY === '0') {
- l('HUSKY env variable is set to 0, skipping install');
- return;
- }
- if (git(['rev-parse']).status !== 0) {
- l(`git command not found, skipping install`);
- return;
- }
- const url = 'https://typicode.github.io/husky/#/?id=custom-directory';
- if (!p.resolve(process.cwd(), dir).startsWith(process.cwd())) {
- throw new Error(`.. not allowed (see ${url})`);
- }
- if (!fs.existsSync('.git')) {
- throw new Error(`.git can't be found (see ${url})`);
- }
- try {
- fs.mkdirSync(p.join(dir, '_'), { recursive: true });
- fs.writeFileSync(p.join(dir, '_/.gitignore'), '*');
- fs.copyFileSync(p.join(__dirname, '../husky.sh'), p.join(dir, '_/husky.sh'));
- const { error } = git(['config', 'core.hooksPath', dir]);
- if (error) {
- throw error;
- }
- }
- catch (e) {
- l('Git hooks failed to install');
- throw e;
- }
- l('Git hooks installed');
-}
-exports.install = install;
-function set(file, cmd) {
- const dir = p.dirname(file);
- if (!fs.existsSync(dir)) {
- throw new Error(`can't create hook, ${dir} directory doesn't exist (try running husky install)`);
- }
- fs.writeFileSync(file, `#!/usr/bin/env sh
-. "$(dirname -- "$0")/_/husky.sh"
-
-${cmd}
-`, { mode: 0o0755 });
- l(`created ${file}`);
-}
-exports.set = set;
-function add(file, cmd) {
- if (fs.existsSync(file)) {
- fs.appendFileSync(file, `${cmd}\n`);
- l(`updated ${file}`);
- }
- else {
- set(file, cmd);
- }
-}
-exports.add = add;
-function uninstall() {
- git(['config', '--unset', 'core.hooksPath']);
-}
-exports.uninstall = uninstall;
\ No newline at end of file
diff --git a/package.json b/package.json
index v8.0.3..v9.0.6 100644
--- a/package.json
+++ b/package.json
@@ -1,40 +1,25 @@
{
- "name": "husky",
- "version": "8.0.3",
- "description": "Modern native Git hooks made easy",
- "keywords": [
- "git",
- "hooks",
- "pre-commit"
- ],
- "homepage": "https://typicode.github.io/husky",
- "repository": "typicode/husky",
- "funding": "https://github.com/sponsors/typicode",
- "license": "MIT",
- "author": "Typicode <typicode@gmail.com>",
- "bin": "lib/bin.js",
- "main": "lib/index.js",
- "files": [
- "lib",
- "husky.sh"
- ],
- "scripts": {
- "build": "tsc",
- "test": "sh test/all.sh",
- "lint": "eslint src --ext .ts",
- "serve": "docsify serve docs",
- "prepare": "npm run build && node lib/bin install"
- },
- "devDependencies": {
- "@commitlint/cli": "^17.3.0",
- "@commitlint/config-conventional": "^17.3.0",
- "@tsconfig/node14": "^1.0.3",
- "@types/node": "^18.11.18",
- "@typicode/eslint-config": "^1.1.0",
- "docsify-cli": "^4.4.4",
- "typescript": "^4.9.4"
- },
- "engines": {
- "node": ">=14"
- }
+ "name": "husky",
+ "version": "9.0.6",
+ "description": "Modern native Git hooks",
+ "keywords": [
+ "git",
+ "hooks",
+ "pre-commit"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/typicode/husky.git"
+ },
+ "funding": "https://github.com/sponsors/typicode",
+ "license": "MIT",
+ "author": "typicode",
+ "type": "module",
+ "bin": {
+ "husky": "bin.js"
+ },
+ "exports": "./index.js",
+ "engines": {
+ "node": ">=18"
+ }
}
diff --git a/README.md b/README.md
index v8.0.3..v9.0.6 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,1 @@
-# husky
-
-> Modern native Git hooks made easy
-
-Husky improves your commits and more 🐶 *woof!*
-
-# Install
-
-```
-npm install husky --save-dev
-```
-
-# Usage
-
-Edit `package.json > prepare` script and run it once:
-
-```sh
-npm pkg set scripts.prepare="husky install"
-npm run prepare
-```
-
-Add a hook:
-
-```sh
-npx husky add .husky/pre-commit "npm test"
-git add .husky/pre-commit
-```
-
-Make a commit:
-
-```sh
-git commit -m "Keep calm and commit"
-# `npm test` will run
-```
-
-# Documentation
-
https://typicode.github.io/husky
diff --git a/husky.sh b/husky.sh
index v8.0.3..v9.0.6 100644
--- a/husky.sh
+++ b/husky.sh
@@ -1,36 +1,21 @@
#!/usr/bin/env sh
-if [ -z "$husky_skip_init" ]; then
- debug () {
- if [ "$HUSKY_DEBUG" = "1" ]; then
- echo "husky (debug) - $1"
- fi
- }
+H="$HUSKY"
+[ "$H" = "2" ] && set -x
+h="${0##*/}"
+s="${0%/*/*}/$h"
- readonly hook_name="$(basename -- "$0")"
- debug "starting $hook_name..."
+[ ! -f "$s" ] && exit 0
- if [ "$HUSKY" = "0" ]; then
- debug "HUSKY env variable is set to 0, skipping hook"
- exit 0
- fi
+for f in "${XDG_CONFIG_HOME:-$HOME/.config}/husky/init.sh" "$HOME/.huskyrc.sh"; do
+ # shellcheck disable=SC1090
+ [ -f "$f" ] && . "$f"
+done
- if [ -f ~/.huskyrc ]; then
- debug "sourcing ~/.huskyrc"
- . ~/.huskyrc
- fi
+[ "$H" = "0" ] && exit 0
- readonly husky_skip_init=1
- export husky_skip_init
- sh -e "$0" "$@"
- exitCode="$?"
+sh -e "$s" "$@"
+c=$?
- if [ $exitCode != 0 ]; then
- echo "husky - $hook_name hook exited with code $exitCode (error)"
- fi
-
- if [ $exitCode = 127 ]; then
- echo "husky - command not found in PATH=$PATH"
- fi
-
- exit $exitCode
-fi
+[ $c != 0 ] && echo "husky - $h script failed (code $c)"
+[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
+exit $c
diff --git a/lib/bin.d.ts b/lib/bin.d.ts
deleted file mode 100644
index v8.0.3..v9.0.6
--- a/lib/bin.d.ts
+++ b/lib/bin.d.ts
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-export {};
\ No newline at end of file
diff --git a/lib/index.d.ts b/lib/index.d.ts
deleted file mode 100644
index v8.0.3..v9.0.6
--- a/lib/index.d.ts
+++ b/lib/index.d.ts
@@ -1,4 +0,0 @@
-export declare function install(dir?: string): void;
-export declare function set(file: string, cmd: string): void;
-export declare function add(file: string, cmd: string): void;
-export declare function uninstall(): void;
\ No newline at end of file
diff --git a/bin.js b/bin.js
new file mode 100755
index v8.0.3..v9.0.6
--- a/bin.js
+++ b/bin.js
@@ -0,0 +1,22 @@
+#!/usr/bin/env node
+import f, { writeFileSync as w } from 'fs'
+import i from './index.js'
+
+let a = process.argv[2]
+
+if (a == 'init') {
+ let p = 'package.json'
+ let d = JSON.parse(f.readFileSync(p))
+ ;(d.scripts ||= {}).prepare = 'husky'
+ w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
+ process.stdout.write(i())
+ try { f.mkdirSync('.husky') } catch {}
+ w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
+ process.exit()
+}
+
+let d = c => console.error(`${c} command is deprecated`)
+if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) }
+if (a == 'install') d(a)
+
+process.stdout.write(i(a == 'install' ? undefined : a))
diff --git a/index.js b/index.js
new file mode 100644
index v8.0.3..v9.0.6
--- a/index.js
+++ b/index.js
@@ -0,0 +1,23 @@
+import c from 'child_process'
+import f, { writeFileSync as w } from 'fs'
+import p from 'path'
+
+let l = [ 'pre-commit', 'prepare-commit-msg', 'commit-msg', 'post-commit', 'applypatch-msg', 'pre-applypatch', 'post-applypatch', 'pre-rebase', 'post-rewrite', 'post-checkout', 'post-merge', 'pre-push', 'pre-auto-gc' ]
+
+export default (d = '.husky') => {
+ if (process.env.HUSKY === '0') return 'HUSKY=0 skip install'
+ if (d.includes('..')) return '.. not allowed'
+ if (!f.existsSync('.git')) return `.git can't be found`
+
+ let _ = (x = '') => p.join(d, '_', x)
+ let { status: s, stderr: e } = c.spawnSync('git', ['config', 'core.hooksPath', `${d}/_`])
+ if (s == null) return 'git command not found'
+ if (s) return '' + e
+
+ f.mkdirSync(_(), { recursive: true })
+ w(_('.gitignore'), '*')
+ f.copyFileSync(new URL('husky.sh', import.meta.url), _('h'))
+ l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 }))
+ w(_('husky.sh'), '')
+ return ''
+}
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index v8.0.3..v9.0.6
--- a/index.d.ts
+++ b/index.d.ts
@@ -0,0 +1,1 @@
+export default function (dir?: string): string;
Command detailsnpm diff --diff=husky@8.0.3 --diff=husky@9.0.6 --diff-unified=2 See also the Reported by ybiquitous/npm-diff-action@v1.5.0 (Node.js 20.11.0 and npm 10.4.0) |
dependabot
bot
force-pushed
the
dependabot/npm_and_yarn/husky-9.0.6
branch
from
January 29, 2024 02:13
0914130
to
8308923
Compare
Bumps [husky](https://github.com/typicode/husky) from 8.0.3 to 9.0.6. - [Release notes](https://github.com/typicode/husky/releases) - [Commits](typicode/husky@v8.0.3...v9.0.6) --- updated-dependencies: - dependency-name: husky dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
dependabot
bot
force-pushed
the
dependabot/npm_and_yarn/husky-9.0.6
branch
from
January 29, 2024 02:15
8308923
to
95b1d98
Compare
ybiquitous
changed the title
build(deps): bump husky from 8.0.3 to 9.0.6
feat(deps): bump husky from 8.0.3 to 9.0.6
Jan 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dependencies
Pull requests that update a dependency file
javascript
Pull requests that update Javascript code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps husky from 8.0.3 to 9.0.6.
Release notes
Sourced from husky's releases.
... (truncated)
Commits
2da78cb
9.0.6797dfdf
Fix: unbound variable (#1359)e7ada20
docs: update install script to mjs and simplify (#1357)534bfed
chore: apply editorconfig to code only (#1355)f446351
docs: add favicon (#1354)8314bef
9.0.556619ec
fix: init error (#1353)26697d1
docs: update path to startup files (#1350)e9526fd
docs: update index.md1e57dc9
9.0.4Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore <dependency name> major version
will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)@dependabot ignore <dependency name> minor version
will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)@dependabot ignore <dependency name>
will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)@dependabot unignore <dependency name>
will remove all of the ignore conditions of the specified dependency@dependabot unignore <dependency name> <ignore condition>
will remove the ignore condition of the specified dependency and ignore conditions