From 49f7e0ebce38f977fbda8c09bae55144b3c72084 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 14:05:15 +0100 Subject: [PATCH 01/13] feat: update tap to 18 BREAKING CHANGE: This update is not backwards compatible with previous versions of testing. This also adds some tests to the skeleton itself showcases how to use mocking with built in plugins, and spies via the added sinon plugin. A .taprc file has also been added as an example of adding some tap configuration. --- .gitignore | 1 + .taprc | 6 +++ lib/content/gitignore | 1 + lib/index.ts | 10 ++--- package.json | 11 ++---- test/index.test.ts | 6 --- test/mustache.test.ts | 91 +++++++++++++++++++++++++++++++++++++++++++ tsconfig.json | 2 + 8 files changed, 109 insertions(+), 19 deletions(-) create mode 100644 .taprc delete mode 100644 test/index.test.ts create mode 100644 test/mustache.test.ts diff --git a/.gitignore b/.gitignore index 0ab192a..c9d91dc 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ !/.gitignore !/.npmrc !/.prettierrc.json +!/.taprc !/Dockerfile !/bin/ !/CHANGELOG* diff --git a/.taprc b/.taprc new file mode 100644 index 0000000..5b510ab --- /dev/null +++ b/.taprc @@ -0,0 +1,6 @@ +# vim: set filetype=yaml : +disable-coverage: false +allow-incomplete-coverage: false +plugin: + - "@tapjs/sinon" + - "!@tapjs/intercept" diff --git a/lib/content/gitignore b/lib/content/gitignore index 0ab192a..c9d91dc 100644 --- a/lib/content/gitignore +++ b/lib/content/gitignore @@ -10,6 +10,7 @@ !/.gitignore !/.npmrc !/.prettierrc.json +!/.taprc !/Dockerfile !/bin/ !/CHANGELOG* diff --git a/lib/index.ts b/lib/index.ts index 424c716..f11a54d 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -67,22 +67,20 @@ export default async function (root: string, variables: Variables) { } ), }, - tap: { - coverage: true, - ts: true, - }, types: "lib/index.d.ts", devDependencies: { "@tsconfig/node18": "^18.0.0", "@types/node": "^18.0.0", - "@types/tap": "^15.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.0.0", - "tap": "^16.0.0", + "tap": "^18.7.0", "ts-node": "^10.0.0", "typescript": "^5.0.0" }, + removeDependencies: [ + "@types/tap" + ] }), "tsconfig.json": json({ set: { diff --git a/package.json b/package.json index 3d6b3b9..56a2841 100644 --- a/package.json +++ b/package.json @@ -22,14 +22,15 @@ "mustache": "^4.2.0" }, "devDependencies": { + "@tapjs/sinon": "^1.1.18", "@tsconfig/node18": "^18.0.0", "@types/mustache": "^4.0.0", "@types/node": "^18.0.0", - "@types/tap": "^15.0.0", + "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.0.0", - "tap": "^16.0.0", + "tap": "^18.7.0", "ts-node": "^10.0.0", "typescript": "5.2.2" }, @@ -54,9 +55,5 @@ "lib/**/*.d.ts", "!lib/types/**", "lib/content/**" - ], - "tap": { - "coverage": true, - "ts": true - } + ] } diff --git a/test/index.test.ts b/test/index.test.ts deleted file mode 100644 index 7b8fbc8..0000000 --- a/test/index.test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import t from "tap"; - -void t.test("this is not a real test", (t) => { - t.pass(); - t.end(); -}); \ No newline at end of file diff --git a/test/mustache.test.ts b/test/mustache.test.ts new file mode 100644 index 0000000..95e1b81 --- /dev/null +++ b/test/mustache.test.ts @@ -0,0 +1,91 @@ +import t from "tap"; +import { mustache } from "../lib/mustache.ts"; + +void t.test("mustache", async (t) => { + await t.test("must include a path", (t) => { + // @ts-expect-error bad data on purpose + t.throws(() => mustache({})); + t.end(); + }); + + await t.test("should generate", async (t) => { + const { mustache } = t.mockRequire("../lib/mustache.ts", { + "node:fs/promises": { + readFile: (path: string) => { + t.equal(path, "path/to/file.txt"); + return Promise.resolve("<% title %>"); + } + } + }); + const variables = { + title: "it generates" + }; + + const generator = mustache({ + path: "path/to/file.txt", + variables, + }); + + const output = await generator.generate(); + t.equal(output, "it generates"); + }); + + await t.test("should validate partials", async (t) => { + const { mustache } = t.mockRequire("../lib/mustache.ts", { + "node:fs/promises": { + readFile: () => Promise.resolve("<% title %>") + } + }); + const variables = { + title: "it generates" + }; + + const generator = mustache({ + path: "path/to/file.txt", + variables, + }); + + const generateSpy = t.sinon.spy(generator, "generate"); + const reportSpy = t.sinon.spy(generator, "report"); + + await generator.validate({ + path: "path/to/file.txt", + found: "it generates\nand handles extras" + }); + + t.equal(generateSpy.callCount, 1); + // Report not called because we passed + t.equal(reportSpy.callCount, 0); + }); + + await t.test("should fail validation when base template not found", async (t) => { + const { mustache } = t.mockRequire("../lib/mustache.ts", { + "node:fs/promises": { + readFile: () => Promise.resolve("<% title %>") + } + }); + const variables = { + title: "it generates" + }; + + const generator = mustache({ + path: "path/to/file.txt", + variables, + }); + + const generateSpy = t.sinon.spy(generator, "generate"); + const reportSpy = t.sinon.spy(generator, "report"); + + await generator.validate({ + path: "path/to/file.txt", + found: "a new file" + }); + + t.equal(generateSpy.callCount, 1); + t.ok(reportSpy.calledOnceWithExactly({ + expected: "it generates", + found: "a new file", + message: "path/to/file.txt does not include the original template" + })); + }); +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 646e651..35d44c1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,8 @@ ".eslintrc.js" ], "compilerOptions": { + "allowImportingTsExtensions": true, + "noEmit": true, "typeRoots": [ "./node_modules/@types", "./lib/types" From 10398b7abcba13afa03d4b763a19f955f1fa4d88 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 14:20:31 +0100 Subject: [PATCH 02/13] docs: add note to readme on ts-node workaround --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 420e145..50dd3eb 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,16 @@ ## Configuration & Usage +**Important Note** on '@tsconfig/node18/tsconfig.json' not found, and Tap: + +There is currently an [issue](https://github.com/tapjs/tapjs/issues/976) in ts-node that causes a loading problem when combined with Tap.js. There is a [recommended](https://github.com/tapjs/tapjs/issues/976#issuecomment-1824784507) workaround for this. Once you update your skeleton, swap out these plugins: + +``` +npx tap plugin add @tapjs/tsx +npx tap plugin rm @tapjs/typescript +``` + + ### CI In your projects `package.json` you can set custom CI variables to extend the default workflow. The following configuration will add a Postgres service to the test job, as well as inject the `DOTENV_KEY` environment variables for dotenv vault usage. From 59e6182d0d69cc12894629c98165a53d8015a708 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 14:32:58 +0100 Subject: [PATCH 03/13] fix: update tap ts plugins --- .taprc | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.taprc b/.taprc index 5b510ab..4f92284 100644 --- a/.taprc +++ b/.taprc @@ -4,3 +4,5 @@ allow-incomplete-coverage: false plugin: - "@tapjs/sinon" - "!@tapjs/intercept" + - "@tapjs/tsx" + - "!@tapjs/typescript" diff --git a/package.json b/package.json index 56a2841..ba86d3c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ }, "devDependencies": { "@tapjs/sinon": "^1.1.18", + "@tapjs/tsx": "^1.1.19", "@tsconfig/node18": "^18.0.0", "@types/mustache": "^4.0.0", "@types/node": "^18.0.0", @@ -32,7 +33,7 @@ "eslint": "^8.0.0", "tap": "^18.7.0", "ts-node": "^10.0.0", - "typescript": "5.2.2" + "typescript": "^5.3.3" }, "peerDependencies": { "code-skeleton": "^2.0.0" From 697e45d52b913a6c72da5944faba455ee215f669 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 14:45:50 +0100 Subject: [PATCH 04/13] fix: update ts build config --- package.json | 2 +- tsconfig.build.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ba86d3c..1510ac1 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "eslint": "^8.0.0", "tap": "^18.7.0", "ts-node": "^10.0.0", - "typescript": "^5.3.3" + "typescript": "5.2.2" }, "peerDependencies": { "code-skeleton": "^2.0.0" diff --git a/tsconfig.build.json b/tsconfig.build.json index c8d7d48..cd7de54 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -6,6 +6,8 @@ "./lib/content/**" ], "compilerOptions": { + "allowImportingTsExtensions": false, + "noEmit": false, "declaration": true }, "//": "This file is partially managed by code-skeleton. Changes may be overwritten." From 532564fb2992d43549896d9cea2c8449d5d36754 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 16:05:25 +0100 Subject: [PATCH 05/13] feat: update to node 20 from 18 --- .github/workflows/ci.yml | 4 ++-- lib/content/ci.yml | 4 ++-- lib/index.ts | 5 +++-- package.json | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6e2b0d..57a3148 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Update npm run: npm i --prefer-online --no-fund --no-audit -g npm@latest - name: Install dependencies @@ -46,7 +46,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Update npm run: npm i --prefer-online --no-fund --no-audit -g npm@latest - name: Install dependencies diff --git a/lib/content/ci.yml b/lib/content/ci.yml index b2237dd..19b699f 100644 --- a/lib/content/ci.yml +++ b/lib/content/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Update npm run: npm i --prefer-online --no-fund --no-audit -g npm@latest - name: Install dependencies @@ -62,7 +62,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Update npm run: npm i --prefer-online --no-fund --no-audit -g npm@latest - name: Install dependencies diff --git a/lib/index.ts b/lib/index.ts index f11a54d..a47d3e4 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -69,7 +69,7 @@ export default async function (root: string, variables: Variables) { }, types: "lib/index.d.ts", devDependencies: { - "@tsconfig/node18": "^18.0.0", + "@tsconfig/node20": "^20.0.0", "@types/node": "^18.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", @@ -79,7 +79,8 @@ export default async function (root: string, variables: Variables) { "typescript": "^5.0.0" }, removeDependencies: [ - "@types/tap" + "@types/tap", + "@tsconfig/node18" ] }), "tsconfig.json": json({ diff --git a/package.json b/package.json index 1510ac1..d220e69 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "devDependencies": { "@tapjs/sinon": "^1.1.18", "@tapjs/tsx": "^1.1.19", - "@tsconfig/node18": "^18.0.0", + "@tsconfig/node20": "^20.0.0", "@types/mustache": "^4.0.0", "@types/node": "^18.0.0", "@types/sinon": "^17.0.3", From a6433411ffa3027e4a402d9d0c3e8b214be806f6 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 16:27:51 +0100 Subject: [PATCH 06/13] chore: add postinstall to build tap plugins --- lib/index.ts | 1 + package.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index a47d3e4..0bc5391 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -66,6 +66,7 @@ export default async function (root: string, variables: Variables) { prepack: "tsc --project tsconfig.build.json", } ), + postinstall: "tap build", }, types: "lib/index.d.ts", devDependencies: { diff --git a/package.json b/package.json index d220e69..66e4529 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "postlint": "npm run skeleton:verify", "skeleton:apply": "code-skeleton apply", "preskeleton:verify": "npm run prepack", - "skeleton:verify": "code-skeleton verify" + "skeleton:verify": "code-skeleton verify", + "postinstall": "tap build" }, "keywords": [], "author": "Nathan LaFreniere ", From 4c764f70eaa1bfaaa2ed1f4dba47e84ebc921eb0 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sat, 27 Jan 2024 17:20:44 +0100 Subject: [PATCH 07/13] fix: allow empty coverage There is currently an issue in CI where code coverage is not being reported even though it runs fine locally. While I look into this I'm going to disable it here for now and test it out in a downstream project with more coverage. --- .taprc | 5 ++++- package.json | 2 ++ test/mustache.test.ts | 8 ++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.taprc b/.taprc index 4f92284..4fbafbf 100644 --- a/.taprc +++ b/.taprc @@ -1,8 +1,11 @@ # vim: set filetype=yaml : disable-coverage: false -allow-incomplete-coverage: false +allow-empty-coverage: true +allow-incomplete-coverage: true plugin: - "@tapjs/sinon" - "!@tapjs/intercept" - "@tapjs/tsx" - "!@tapjs/typescript" +color: true +reporter: base diff --git a/package.json b/package.json index 66e4529..06703e1 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "mustache": "^4.2.0" }, "devDependencies": { + "@istanbuljs/esm-loader-hook": "^0.2.0", + "@tapjs/esbuild-kit": "^1.1.19", "@tapjs/sinon": "^1.1.18", "@tapjs/tsx": "^1.1.19", "@tsconfig/node20": "^20.0.0", diff --git a/test/mustache.test.ts b/test/mustache.test.ts index 95e1b81..87d4b1e 100644 --- a/test/mustache.test.ts +++ b/test/mustache.test.ts @@ -1,5 +1,5 @@ import t from "tap"; -import { mustache } from "../lib/mustache.ts"; +import { mustache } from "../lib/mustache"; void t.test("mustache", async (t) => { await t.test("must include a path", (t) => { @@ -9,7 +9,7 @@ void t.test("mustache", async (t) => { }); await t.test("should generate", async (t) => { - const { mustache } = t.mockRequire("../lib/mustache.ts", { + const { mustache } = t.mockRequire("../lib/mustache", { "node:fs/promises": { readFile: (path: string) => { t.equal(path, "path/to/file.txt"); @@ -31,7 +31,7 @@ void t.test("mustache", async (t) => { }); await t.test("should validate partials", async (t) => { - const { mustache } = t.mockRequire("../lib/mustache.ts", { + const { mustache } = t.mockRequire("../lib/mustache", { "node:fs/promises": { readFile: () => Promise.resolve("<% title %>") } @@ -59,7 +59,7 @@ void t.test("mustache", async (t) => { }); await t.test("should fail validation when base template not found", async (t) => { - const { mustache } = t.mockRequire("../lib/mustache.ts", { + const { mustache } = t.mockRequire("../lib/mustache", { "node:fs/promises": { readFile: () => Promise.resolve("<% title %>") } From bc45c724784c9ddddf7f94b5203efb735d994a17 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 28 Jan 2024 10:58:27 +0100 Subject: [PATCH 08/13] 2.0.0-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 06703e1..fda9316 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code4rena/skeleton", - "version": "1.2.1", + "version": "2.0.0-0", "description": "", "main": "lib/index.js", "scripts": { From b464bee7726ce154b32233e7ec1f1c20239e60d9 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 28 Jan 2024 11:08:44 +0100 Subject: [PATCH 09/13] fix: tsconfig version template --- lib/index.ts | 2 +- package.json | 2 -- tsconfig.json | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 0bc5391..da4e815 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -87,7 +87,7 @@ export default async function (root: string, variables: Variables) { "tsconfig.json": json({ set: { "//": "This file is partially managed by code-skeleton. Changes may be overwritten.", - extends: "@tsconfig/node18/tsconfig.json", + extends: "@tsconfig/node20/tsconfig.json", }, append: { include: [ diff --git a/package.json b/package.json index fda9316..5bb84c0 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,6 @@ "mustache": "^4.2.0" }, "devDependencies": { - "@istanbuljs/esm-loader-hook": "^0.2.0", - "@tapjs/esbuild-kit": "^1.1.19", "@tapjs/sinon": "^1.1.18", "@tapjs/tsx": "^1.1.19", "@tsconfig/node20": "^20.0.0", diff --git a/tsconfig.json b/tsconfig.json index 35d44c1..9db2502 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@tsconfig/node18/tsconfig.json", + "extends": "@tsconfig/node20/tsconfig.json", "include": [ "**/*.ts", ".eslintrc.js" From 5467e4b689bd7b5440679d3f56459073b3da5301 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 28 Jan 2024 11:09:50 +0100 Subject: [PATCH 10/13] 2.0.0-1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bb84c0..8ab70c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code4rena/skeleton", - "version": "2.0.0-0", + "version": "2.0.0-1", "description": "", "main": "lib/index.js", "scripts": { From f683c8846c0f69ee257483e31d7f62f89896cc94 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 28 Jan 2024 13:00:54 +0100 Subject: [PATCH 11/13] fix: update node types to 20.x --- lib/index.ts | 2 +- package.json | 2 +- tsconfig.build.json | 2 -- tsconfig.json | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index da4e815..bd50280 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -71,7 +71,7 @@ export default async function (root: string, variables: Variables) { types: "lib/index.d.ts", devDependencies: { "@tsconfig/node20": "^20.0.0", - "@types/node": "^18.0.0", + "@types/node": "^20.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.0.0", diff --git a/package.json b/package.json index 8ab70c0..68f06de 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@tapjs/tsx": "^1.1.19", "@tsconfig/node20": "^20.0.0", "@types/mustache": "^4.0.0", - "@types/node": "^18.0.0", + "@types/node": "^20.0.0", "@types/sinon": "^17.0.3", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", diff --git a/tsconfig.build.json b/tsconfig.build.json index cd7de54..c8d7d48 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -6,8 +6,6 @@ "./lib/content/**" ], "compilerOptions": { - "allowImportingTsExtensions": false, - "noEmit": false, "declaration": true }, "//": "This file is partially managed by code-skeleton. Changes may be overwritten." diff --git a/tsconfig.json b/tsconfig.json index 9db2502..78bbd7e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,8 +5,6 @@ ".eslintrc.js" ], "compilerOptions": { - "allowImportingTsExtensions": true, - "noEmit": true, "typeRoots": [ "./node_modules/@types", "./lib/types" From 51e32e7bb6301dac8eb57a3e5da360fa3ddf7746 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 4 Feb 2024 13:01:15 +0100 Subject: [PATCH 12/13] fix: swap to tsx over ts-node chore: lock tsx to 4.2.1 to mitigate test coverage reporting 100% when not testing compiled js --- lib/content/clean.ts | 2 +- lib/content/update-shebang.ts | 4 ++-- lib/index.ts | 9 ++++++++- package.json | 9 +++++++-- scripts/clean.ts | 2 +- scripts/update-shebang.ts | 4 ++-- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/content/clean.ts b/lib/content/clean.ts index 9613424..f9c08ba 100755 --- a/lib/content/clean.ts +++ b/lib/content/clean.ts @@ -1,4 +1,4 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env tsx // This file is managed by code-skeleton. Do not make changes. import { rmSync } from "node:fs"; diff --git a/lib/content/update-shebang.ts b/lib/content/update-shebang.ts index 445dd77..9bfe153 100755 --- a/lib/content/update-shebang.ts +++ b/lib/content/update-shebang.ts @@ -1,11 +1,11 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env tsx import { spawnSync } from "node:child_process"; import { readFile, writeFile } from "node:fs/promises"; import { dirname, resolve } from "node:path"; const ROOT = dirname(__dirname); -const tsShebang = "#!/usr/bin/env ts-node"; +const tsShebang = "#!/usr/bin/env tsx"; const jsShebang = "#!/usr/bin/env node"; async function updateShebang (path: string) { diff --git a/lib/index.ts b/lib/index.ts index bd50280..49d4057 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -76,9 +76,16 @@ export default async function (root: string, variables: Variables) { "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.0.0", "tap": "^18.7.0", - "ts-node": "^10.0.0", + "tsx": "4.2.1", "typescript": "^5.0.0" }, + "overrides": { + // Needed with the 4.2.1 tsx version lock to fix code coverage + // https://github.com/privatenumber/tsx/issues/433 + "@tapjs/tsx": { + "tsx": "$tsx" + } + }, removeDependencies: [ "@types/tap", "@tsconfig/node18" diff --git a/package.json b/package.json index 68f06de..d289588 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,17 @@ "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.0.0", "tap": "^18.7.0", - "ts-node": "^10.0.0", - "typescript": "5.2.2" + "tsx": "4.2.1", + "typescript": "^5.0.0" }, "peerDependencies": { "code-skeleton": "^2.0.0" }, + "overrides": { + "@tapjs/tsx": { + "tsx": "$tsx" + } + }, "skeleton": { "module": ".", "variables": { diff --git a/scripts/clean.ts b/scripts/clean.ts index 9613424..f9c08ba 100755 --- a/scripts/clean.ts +++ b/scripts/clean.ts @@ -1,4 +1,4 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env tsx // This file is managed by code-skeleton. Do not make changes. import { rmSync } from "node:fs"; diff --git a/scripts/update-shebang.ts b/scripts/update-shebang.ts index 445dd77..9bfe153 100755 --- a/scripts/update-shebang.ts +++ b/scripts/update-shebang.ts @@ -1,11 +1,11 @@ -#!/usr/bin/env ts-node +#!/usr/bin/env tsx import { spawnSync } from "node:child_process"; import { readFile, writeFile } from "node:fs/promises"; import { dirname, resolve } from "node:path"; const ROOT = dirname(__dirname); -const tsShebang = "#!/usr/bin/env ts-node"; +const tsShebang = "#!/usr/bin/env tsx"; const jsShebang = "#!/usr/bin/env node"; async function updateShebang (path: string) { From b3a0eb191d3cb627ef58e8f40b32b3dbaa7ad5f7 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Sun, 4 Feb 2024 13:17:02 +0100 Subject: [PATCH 13/13] 2.0.0-2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d289588..3b502b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@code4rena/skeleton", - "version": "2.0.0-1", + "version": "2.0.0-2", "description": "", "main": "lib/index.js", "scripts": {