From 007ede617ee89ad08443b767c2472ed235b041e5 Mon Sep 17 00:00:00 2001 From: Adam Fisher Date: Tue, 4 Aug 2026 14:20:36 +0000 Subject: [PATCH] Adopt .tool-versions and standardise script/ for Deno 2 Pins deno 2 in .tool-versions. Adds script/setup with a PATH check. script/start and script/test gain set -euo pipefail and the cd to project root. Rewrites the README to the shared template and removes the Windows and homebrew sections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- typescript-deno/.tool-versions | 1 + typescript-deno/README.md | 38 ++++++++++++++++++++++++---------- typescript-deno/script/setup | 7 +++++++ typescript-deno/script/start | 4 +++- typescript-deno/script/test | 4 +++- 5 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 typescript-deno/.tool-versions create mode 100755 typescript-deno/script/setup diff --git a/typescript-deno/.tool-versions b/typescript-deno/.tool-versions new file mode 100644 index 0000000..776e434 --- /dev/null +++ b/typescript-deno/.tool-versions @@ -0,0 +1 @@ +deno 2 diff --git a/typescript-deno/README.md b/typescript-deno/README.md index 0675ad6..48facad 100644 --- a/typescript-deno/README.md +++ b/typescript-deno/README.md @@ -2,23 +2,26 @@ 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 @@ -26,3 +29,16 @@ If using VSCode, you might want to enable the extension in the settings: - 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"] +} +``` diff --git a/typescript-deno/script/setup b/typescript-deno/script/setup new file mode 100755 index 0000000..0ca8275 --- /dev/null +++ b/typescript-deno/script/setup @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +deno cache src/mod.test.ts diff --git a/typescript-deno/script/start b/typescript-deno/script/start index b0d1a3e..ab53f08 100755 --- a/typescript-deno/script/start +++ b/typescript-deno/script/start @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." deno run src/mod.ts diff --git a/typescript-deno/script/test b/typescript-deno/script/test index f3f2ab4..e7d024f 100755 --- a/typescript-deno/script/test +++ b/typescript-deno/script/test @@ -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