From 4cf85e54f26cf653d9e6169ecd38144b4c31b044 Mon Sep 17 00:00:00 2001 From: Adam Fisher Date: Tue, 4 Aug 2026 14:21:34 +0000 Subject: [PATCH] Adopt .tool-versions and standardise scripts .nvmrc contained `lts/*`, which pins no version and requires nvm. .tool-versions replaces it with explicit major versions for node and yarn. script/setup gains the standard PATH check. Adds script/start, which the project had no equivalent of. Updates the README to document the toolchain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- javascript/.nvmrc | 1 - javascript/.tool-versions | 2 ++ javascript/README.md | 28 ++++++++++++++++++++++------ javascript/package.json | 1 + javascript/script/setup | 4 +++- javascript/script/start | 7 +++++++ 6 files changed, 35 insertions(+), 8 deletions(-) delete mode 100644 javascript/.nvmrc create mode 100644 javascript/.tool-versions create mode 100755 javascript/script/start diff --git a/javascript/.nvmrc b/javascript/.nvmrc deleted file mode 100644 index 1a2f5bd..0000000 --- a/javascript/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -lts/* \ No newline at end of file diff --git a/javascript/.tool-versions b/javascript/.tool-versions new file mode 100644 index 0000000..e2d8fff --- /dev/null +++ b/javascript/.tool-versions @@ -0,0 +1,2 @@ +node 22 +yarn 3 diff --git a/javascript/README.md b/javascript/README.md index 14b35ca..a54a207 100644 --- a/javascript/README.md +++ b/javascript/README.md @@ -1,14 +1,30 @@ -# Javascript +# JavaScript -Skeleton project for Javascript with Jest for testing. +Skeleton project for JavaScript. -## Usage -- `./script/setup` to install dependencies -- `./script/test` to run the tests +## Prerequisites + +The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions): + +``` +node 22 +yarn 3 +``` +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/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 [`index.js`](./src/index.js) - Tests located in [`index.test.js`](./src/index.test.js) -However, you're free to organise your code as you like. +However, you're free to organise your code as you like. diff --git a/javascript/package.json b/javascript/package.json index 46bc4fb..2c21315 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -5,6 +5,7 @@ "jest": "^29.5.0" }, "scripts": { + "start": "node src/index.js", "test": "jest" } } diff --git a/javascript/script/setup b/javascript/script/setup index d302646..e2cee61 100755 --- a/javascript/script/setup +++ b/javascript/script/setup @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." yarn diff --git a/javascript/script/start b/javascript/script/start new file mode 100755 index 0000000..61c9770 --- /dev/null +++ b/javascript/script/start @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +yarn start