@hongminhee/deno-task-hooks@0.1.2Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
A simple way to run Deno tasks as Git hooks
deno-task-hooks
This package provides a simple way to run Deno tasks as Git hooks. You can define Git hooks in your deno.json file and share them with your team.
How to set up
First of all, you need to add hooks:install
task to your deno.json file:
{ "tasks": { "hooks:install": "deno run --allow-read=deno.json,.git/hooks/ --allow-write=.git/hooks/ jsr:@hongminhee/deno-task-hooks" } }
This hooks:install
task will install the hooks defined in your deno.json
file to your .git/hooks directory. Let your team members run this task
immediately after cloning your repository.
Then, you can define your Git hooks in your deno.json file. All hooks are
prefixed with hooks:
and followed by the hook name (which is kebab-cased).
For example, to define a pre-commit
hook, you can add the following task:
{ "tasks": { "hooks:pre-commit": "deno check *.ts && deno lint" } }
Then, install the hooks by running the following command:
deno task hooks:install
Now, the pre-commit
hook is installed to your .git/hooks directory. That's
it! You can now run git commit
and see your pre-commit
hook in action.
Add Package
deno add jsr:@hongminhee/deno-task-hooks
Import symbol
import * as deno_task_hooks from "@hongminhee/deno-task-hooks";
Import directly with a jsr specifier
import * as deno_task_hooks from "jsr:@hongminhee/deno-task-hooks";