My deno dev template with sample scripts, tests, tasks (including git hooks) and workflows.
You can customize as you like.
Create repository by this template, or just copy deno.jsonc in this repository
to your project.
Run deno task setup-hooks at first or when you add git hooks definitions.
There are small scripts generated by deno init and sample API server:
- main.ts
- main_bench.ts
- main_test.ts
- server.ts
- This server is running on Deno Deploy.
Some utility scripts is in scripts directory:
- lint-staged.ts
- Run lint-staged with configurations
in
deno.jsonc. - Read, env, run and write permissions are required.
- To use this, add
lint-stagedkey indeno.jsoncand add configurations.
- Run lint-staged with configurations
in
- setup-hooks.ts
- Setup git hooks defined in
deno.jsoncusing deno_hooks. - Read and run permissions are required (in addition, this script give a write permission to deno_hooks).
- To use this, add tasks in
deno.jsoncwith a key with the same name as git hooks (e.g. pre-commit, commit-msg). - You can also specify the directory where the hooks are defined using the key
hooks_dir(default is .hooks).
- Setup git hooks defined in
deno.jsonc should look like this to use above scripts:
💡 You can specify versions of scripts:
https://pax.deno.dev/kawarimidoll/[email protected]/scripts/setup-hooks.ts
Available Tasks:
- run
- Define common permissions.
- Using this task allows omitting permission declarations in other task definitions.
- dev
- Run main script with '--watch' flag.
- main
- Run main script once.
- start
- Start server script.
- test
- Run tests.
- Don't return error if no test files are found.
- cov
- Run tests and show coverage.
- lint
- Run lint (excluding coverage directory).
- fmt
- Run formatting (excluding coverage directory).
- ci
- Execute lint, formatting, and tests.
- deps
- Update dependencies using deno-udd.
- setup-hooks
- Set up the following git hooks.
- commit-msg
- Validate commit messages with commitlint.
- pre-commit
- Execute processes defined in lint-staged.
- pre-push
- Execute
deno task ci.
- Execute
Workflows of GitHub Actions are defined:
- ci
- Run
deno task cion pull request.
- Run
- udd
- Run
deno task depson workflow_dispatch. - It is useful to run it periodically by scheduling.
- Run
MIT