generated from kawarimidoll/deno-dev-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ee4de2
commit fdbd6e4
Showing
1 changed file
with
25 additions
and
57 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,40 @@ | ||
# deno-dev-template | ||
# deno-markup-tag | ||
|
||
[![ci](https://github.com/kawarimidoll/deno-dev-template/workflows/ci/badge.svg)](.github/workflows/ci.yml) | ||
[![ci](https://github.com/kawarimidoll/deno-markup-tag/workflows/ci/badge.svg)](.github/workflows/ci.yml) | ||
[![deno.land](https://img.shields.io/badge/deno-%5E1.0.0-green?logo=deno)](https://deno.land) | ||
[![vr scripts](https://badges.velociraptor.run/flat.svg)](https://velociraptor.run) | ||
[![LICENSE](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE) | ||
[![tag](https://img.shields.io/github/v/tag/kawarimidoll/deno-markup-tag?sort=semver)](https://github.com/kawarimidoll/deno-markup-tag/tags) | ||
|
||
my deno template | ||
## Usage | ||
|
||
Confirm there is `~/.deno/bin` in `$PATH` to use the scripts installed by | ||
`deno install`. | ||
### tag | ||
|
||
## Run with Velociraptor | ||
|
||
Need to install [Velociraptor](https://velociraptor.run/). | ||
|
||
``` | ||
$ # install velociraptor | ||
$ deno install -qAn vr https://deno.land/x/velociraptor/cli.ts | ||
$ # install hook | ||
$ vr | ||
``` | ||
|
||
The scripts are defined in [velociraptor.yml](/velociraptor.yml). | ||
|
||
### Run main.ts | ||
|
||
``` | ||
$ vr start | ||
``` | ||
|
||
### Start server.ts | ||
|
||
Need to install [deployctl](https://deno.com/deploy/docs/deployctl). | ||
|
||
``` | ||
$ # install deployctl | ||
$ deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -f https://deno.land/x/deploy/deployctl.ts | ||
$ # start server | ||
$ vr dev | ||
``` | ||
|
||
### Run tests | ||
|
||
Need to create `.env`. | ||
|
||
``` | ||
$ # create .env | ||
$ cp .env.example .env | ||
$ # run tests | ||
$ vr test | ||
``` | ||
```ts | ||
// common usage | ||
assertEquals( | ||
tag("div", { id: "foo", class: "bar" }, "Hello world!"), | ||
`<div id="foo" class="bar">Hello world!</div>`, | ||
); | ||
|
||
### Run CI | ||
// void (no-close) tag | ||
assertEquals(tag("meta", { charset: "utf-8" }), `<meta charset="utf-8">`); | ||
|
||
``` | ||
$ # run lint, format, tests | ||
$ vr ci | ||
// nested tags | ||
assertEquals( | ||
tag("ul", { class: "nav" }, tag("li", "first"), tag("li", "second")), | ||
`<ul class="nav"><li>first</li><li>second</li></ul>`, | ||
); | ||
``` | ||
|
||
## Logger | ||
### Character references | ||
|
||
Import from `logger.ts`. | ||
These constants are exported. | ||
|
||
```ts | ||
import { Logger } from "./logger.ts"; | ||
|
||
Logger.debug("This log is debug!"); | ||
Logger.info("This log is info!"); | ||
Logger.warning("This log is warning!"); | ||
Logger.error("This log is error!"); | ||
const NBSP = " "; | ||
const LT = "<"; | ||
const GT = ">"; | ||
const AMP = "&"; | ||
const QUOT = """; | ||
``` |