Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions typescript-deno/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno 2
38 changes: 27 additions & 11 deletions typescript-deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,43 @@

Skeleton project for TypeScript with testing via [Deno](https://deno.land/).

Make sure you have Deno installed by running `deno --version`.
## Prerequisites

If using VSCode, you might want to enable the extension in the settings:
The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions):

```jsonc
// .vscode/settings.json
{
"deno.enable": true,
// or specifically
"deno.enablePaths": ["./typescript-deno"]
}
```
deno 2
```

Install those however you prefer, as long as they end up on your `PATH`. The quickest route is
[mise](https://mise.jdx.dev/), which reads the file for you:

```sh
mise install
```

## Usage

- `./script/start` to run the source code
- `./script/test` to run the tests in watch mode
- `./script/setup` to fetch dependencies
- `./script/test` to run the tests, or `./script/test --watch` to re-run them on every change
- `./script/start` to run the app

## Structure

- Code located in [`mod.ts`](./src/mod.ts)
- Tests located in [`mod.test.ts`](./src/mod.test.ts)

However, you are free to organise your code as you like.

## VSCode

If using VSCode, you might want to enable the Deno extension in the settings:

```jsonc
// .vscode/settings.json
{
"deno.enable": true,
// or specifically
"deno.enablePaths": ["./typescript-deno"]
}
```
7 changes: 7 additions & 0 deletions typescript-deno/script/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

deno cache src/mod.test.ts
4 changes: 3 additions & 1 deletion typescript-deno/script/start
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

deno run src/mod.ts
4 changes: 3 additions & 1 deletion typescript-deno/script/test
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

if [[ "${1:-}" == "--watch" ]]; then
deno test src --watch
Expand Down
Loading