Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kawarimidoll/deno-dev-template

My deno dev template with sample scripts, tests, tasks (including git hooks) and workflows.
https://github.com/kawarimidoll/deno-dev-template

deno template-repository

Last synced: 3 months ago
JSON representation

My deno dev template with sample scripts, tests, tasks (including git hooks) and workflows.

Awesome Lists containing this project

README

        

# deno-dev-template

[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/kawarimidoll/deno-dev-template?sort=semver)](releases)
[![ci](https://github.com/kawarimidoll/deno-dev-template/workflows/ci/badge.svg)](.github/workflows/ci.yml)
[![deno.land](https://img.shields.io/badge/deno-%5E1.34.0-green?logo=deno)](https://deno.land)
[![LICENSE](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)

My deno dev template with sample scripts, tests, tasks (including git hooks) and
workflows.

You can customize as you like.

## Setup

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.

### Scripts

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](https://cloudy-owl-71.deno.dev/).

Some utility scripts is in `scripts` directory:

- lint-staged.ts
- Run [lint-staged](https://github.com/okonet/lint-staged) with configurations
in `deno.jsonc`.
- Read, env, run and write permissions are required.
- To use this, add `lint-staged` key in `deno.jsonc` and add configurations.
- setup-hooks.ts
- Setup git hooks defined in `deno.jsonc` using
[deno_hooks](https://github.com/Yakiyo/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.jsonc` with 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).

`deno.jsonc` should look like this to use above scripts:

```jsonc
// deno.jsonc
{
"lint-staged": {
"*": "deno lint && deno fmt"
},
"hooks_dir": ".my_hooks",
"tasks": {
"setup-hooks": "deno run --allow-read --allow-run https://pax.deno.dev/kawarimidoll/deno-dev-template/scripts/setup-hooks.ts",
"pre-commit": "deno run --allow-read --allow-env --allow-run --allow-write https://pax.deno.dev/kawarimidoll/deno-dev-template/scripts/lint-staged.ts",
"pre-push": "deno test"
}
}
```

💡 You can specify versions of scripts:
`https://pax.deno.dev/kawarimidoll/[email protected]/scripts/setup-hooks.ts`

### Tasks

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](https://github.com/hayd/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`.

### Workflows

Workflows of GitHub Actions are defined:

- ci
- Run `deno task ci` on pull request.
- udd
- Run `deno task deps` on workflow_dispatch.
- It is useful to run it periodically by scheduling.

## Author

[kawarimidoll](https://github.com/kawarimidoll)

## License

MIT