{"id":18686842,"url":"https://github.com/yakiyo/deno_hooks","last_synced_at":"2025-04-12T05:07:28.168Z","repository":{"id":62459596,"uuid":"560559793","full_name":"Yakiyo/deno_hooks","owner":"Yakiyo","description":"Husky inspired easy-to-use git hooks manager for deno","archived":false,"fork":false,"pushed_at":"2024-05-16T12:38:56.000Z","size":23,"stargazers_count":26,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T12:02:55.117Z","etag":null,"topics":["deno-module","git","git-hooks"],"latest_commit_sha":null,"homepage":"https://deno.land/x/deno_hooks","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yakiyo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-01T19:06:00.000Z","updated_at":"2025-03-29T23:52:55.000Z","dependencies_parsed_at":"2024-05-16T13:57:26.608Z","dependency_job_id":null,"html_url":"https://github.com/Yakiyo/deno_hooks","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"6b8dd98386369f58a4f507fcfda559d7e3cb8cd7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fdeno_hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fdeno_hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fdeno_hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fdeno_hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yakiyo","download_url":"https://codeload.github.com/Yakiyo/deno_hooks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248519543,"owners_count":21117761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno-module","git","git-hooks"],"created_at":"2024-11-07T10:29:30.945Z","updated_at":"2025-04-12T05:07:28.136Z","avatar_url":"https://github.com/Yakiyo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno Hooks [![CI](https://github.com/Yakiyo/deno_hooks/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Yakiyo/deno_hooks/actions/workflows/ci.yml)\n\nA husky inspired git hooks manager for Deno.\n\nZero dependency, lightweight and fast.\n\n## Usage\n\nRun the script through Deno in your project/workspace\n\n```bash\n$ deno run --allow-read --allow-run --allow-write https://deno.land/x/deno_hooks@0.1.1/mod.ts install\n```\n\nOptionally, add it as a deno task (recommended):\n\nIn your projects `deno.json` file, add it to the task section.\n\n```json\n{\n\t// --snip--\n\t\"tasks\": {\n\t\t\"hook\": \"deno run --allow-read --allow-run --allow-write https://deno.land/x/deno_hooks@0.1.1/mod.ts\"\n\t}\n}\n```\n\nNow you can run this quickly with `deno task hook`. Any additional\narguments provided after the invocation will get passed to the file.\n\n### Commands:\n\n- Install it once\n\n```bash\n$ deno task hook install\n```\n\nThis creates a folder called `.hooks` for your git hooks. You can pass\na folder name of your choice too if you want. Defaults to `.hooks`\n\n- Add a hook\n\n```bash\n$ deno task hook add .hooks/pre-commit \"deno fmt --check\"\n```\n\nThis creates a shell file named `pre-commit`. Now, everytime u make a\ncommit, git will run the command `deno fmt --check` to check for\nformatting errors. If theres no error, the commit passes, otherwise it\nthrows an error and aborts the commit. If u try to add an existing\ntask, then the provided command gets appended to the existing hook\nfile.\n\nYou can find a list of all git hooks\n[here](https://git-scm.com/docs/githooks). Just add a new hook with\nthe corresponding name to make it work.\n\n- Uninstall\n\n```bash\n$ deno task hook uninstall\n```\n\nThis resets git's hookpath to the default. All hooks in your custom\ndirectory becomes unusable after that. You can delete the directory if\nyou want.\n\n### Customization\n\nIt's pretty straight forward. So theres nothing much to customize in\nit. If for some reason you don't want to run the pre-commit or\ncorresponding hook for a git action u can use the `--no-verify` flag\n\n```bash\n$ git commit --no-verify -m \"Rip Hooks\"\n```\n\nThis skips the pre-commit hook. For git actions that dont have a no\nverify flag, u can use the `HOOK` environment variable to skip the\ncheck. Just pass the value of HOOK as 0\n\n```bash\n$ HOOK=0 git commit -m \"Skipping hook\"\n```\n\nIf you want to test your git hooks without making a commit, just add\n`exit 1` to the end of your hook file so that git aborts the commit in\nthe end.\n\n```sh\n#!/usr/bin/env sh\n. \"$(dirname -- \"$0\")/_/hook.sh\"\n\ndeno lint\ndeno fmt --check\nexit 1\n```\n\nThe hook files themselves need to be shell scripts, but you can run\nexternal scripts from it.\n\n```sh\n#!/usr/bin/env sh\n. \"$(dirname -- \"$0\")/_/hook.sh\"\n\n# Running a ts file with deno\ndeno run scripts/test.ts\n\n# Or maybe running a python file\npython script.py\n```\n\n## Usage with lint-staged\n\nFor advanced usage, it's possible to use this project with\n[lint-staged](https://github.com/lint-staged/lint-staged) by adding\nthe following hook:\n\n```bash\n$ deno task hook add .hooks/pre-commit \"deno run -A npm:lint-staged\"\n```\n\nThen create a `.lintstagedrc` file in the root of your repo, according\nto the documentation of lint-staged.\n\n## Using with non-deno projects\n\nThe module only depends on deno to run, but it doesn't necessarily\nneed to be used only in a deno project. Unlike husky or npm, deno\ndoesnt have anything like a `package.json` file, so as long as you\nhave deno, u can use it in any project without any extra config files.\n\n## Credits\n\nThis project was completely inspired by typicode's\n[husky](https://github.com/typicode/husky) and most of the code\nadapted from husky's code too. If you like this project, consider\ngiving husky's repository a visit too. Please star this project if it\nwas useful to you.\n\n## Author\n\n**deno_hooks** © [Yakiyo](https://github.com/Yakiyo). Authored and\nmaintained by Yakiyo.\n\nReleased under [MIT](https://opensource.org/licenses/MIT) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakiyo%2Fdeno_hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakiyo%2Fdeno_hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakiyo%2Fdeno_hooks/lists"}