diff --git a/package.json b/package.json index f8a7f18b..cac54a57 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "6.0.0", "private": true, "description": "Publish code coverage to Code Climate", + "type": "module", "main": "lib/main.js", "packageManager": "pnpm@9.0.6", "scripts": { @@ -35,14 +36,17 @@ "@actions/exec": "1.1.1", "@actions/github": "6.0.0", "@actions/glob": "0.4.0", - "hook-std": "2.0.0", - "node-fetch": "2.7.0", + "hook-std": "3.0.0", + "node-fetch": "3.3.2", "openpgp": "5.11.1" }, "devDependencies": { "@biomejs/biome": "1.7.1", "@openpgp/web-stream-tools": "0.1.1", + "@tapjs/core": "1.5.2", "@tapjs/test": "1.4.2", + "@tsconfig/node20": "20.1.4", + "@tsconfig/strictest": "2.0.5", "@types/node": "20.12.7", "@types/node-fetch": "2.6.11", "@types/sinon": "17.0.3", @@ -51,7 +55,8 @@ "nock": "13.5.4", "sinon": "17.0.1", "tap": "18.7.2", - "to-readable-stream": "2.1.0", + "to-readable-stream": "4.0.0", + "ts-node": "10.9.2", "typescript": "5.4.5", "which": "4.0.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 505fb563..51251ec4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,11 +21,11 @@ importers: specifier: 0.4.0 version: 0.4.0 hook-std: - specifier: 2.0.0 - version: 2.0.0 + specifier: 3.0.0 + version: 3.0.0 node-fetch: - specifier: 2.7.0 - version: 2.7.0(encoding@0.1.13) + specifier: 3.3.2 + version: 3.3.2 openpgp: specifier: 5.11.1 version: 5.11.1 @@ -36,9 +36,18 @@ importers: '@openpgp/web-stream-tools': specifier: 0.1.1 version: 0.1.1(typescript@5.4.5) + '@tapjs/core': + specifier: 1.5.2 + version: 1.5.2(@types/node@20.12.7)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) '@tapjs/test': specifier: 1.4.2 version: 1.4.2(@tapjs/core@1.5.2(@types/node@20.12.7)(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(@types/node@20.12.7)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@tsconfig/node20': + specifier: 20.1.4 + version: 20.1.4 + '@tsconfig/strictest': + specifier: 2.0.5 + version: 2.0.5 '@types/node': specifier: 20.12.7 version: 20.12.7 @@ -64,8 +73,11 @@ importers: specifier: 18.7.2 version: 18.7.2(@types/node@20.12.7)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(typescript@5.4.5) to-readable-stream: - specifier: 2.1.0 - version: 2.1.0 + specifier: 4.0.0 + version: 4.0.0 + ts-node: + specifier: 10.9.2 + version: 10.9.2(@types/node@20.12.7)(typescript@5.4.5) typescript: specifier: 5.4.5 version: 5.4.5 @@ -458,17 +470,32 @@ packages: peerDependencies: '@tapjs/core': 1.5.2 + '@tsconfig/node10@1.0.11': + resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} + + '@tsconfig/node12@1.0.11': + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + + '@tsconfig/node14@1.0.3': + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + '@tsconfig/node14@14.1.0': resolution: {integrity: sha512-VmsCG04YR58ciHBeJKBDNMWWfYbyP8FekWVuTlpstaUPlat1D0x/tXzkWP7yCMU0eSz9V4OZU0LBWTFJ3xZf6w==} + '@tsconfig/node16@1.0.4': + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + '@tsconfig/node16@16.1.1': resolution: {integrity: sha512-+pio93ejHN4nINX4pXqfnR/fPLRtJBaT4ORaa5RH0Oc1zoYmo2B2koG+M328CQhHKn1Wj6FcOxCDFXAot9NhvA==} '@tsconfig/node18@18.2.2': resolution: {integrity: sha512-d6McJeGsuoRlwWZmVIeE8CUA27lu6jLjvv1JzqmpsytOYYbVi1tHZEnwCNVOXnj4pyLvneZlFlpXUK+X9wBWyw==} - '@tsconfig/node20@20.1.2': - resolution: {integrity: sha512-madaWq2k+LYMEhmcp0fs+OGaLFk0OenpHa4gmI4VEmCKX4PJntQ6fnnGADVFrVkBj0wIdAlQnK/MrlYTHsa1gQ==} + '@tsconfig/node20@20.1.4': + resolution: {integrity: sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==} + + '@tsconfig/strictest@2.0.5': + resolution: {integrity: sha512-ec4tjL2Rr0pkZ5hww65c+EEPYwxOi4Ryv+0MtjeaSQRJyq322Q27eOQiFbuNgw2hpL4hB1/W/HBGk3VKS43osg==} '@tufjs/canonical-json@2.0.0': resolution: {integrity: sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA==} @@ -654,6 +681,9 @@ packages: resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + cross-env@7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'} @@ -663,6 +693,10 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} + data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + debug@4.3.4: resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -725,6 +759,10 @@ packages: exponential-backoff@3.1.1: resolution: {integrity: sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==} + fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + fill-range@7.0.1: resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} engines: {node: '>=8'} @@ -745,6 +783,10 @@ packages: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} + formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + fromentries@1.3.2: resolution: {integrity: sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==} @@ -797,9 +839,9 @@ packages: resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} engines: {node: '>= 0.4'} - hook-std@2.0.0: - resolution: {integrity: sha512-zZ6T5WcuBMIUVh49iPQS9t977t7C0l7OtHrpeMb5uk48JdflRX0NSFvCekfYNmGQETnLq9W/isMyHl69kxGi8g==} - engines: {node: '>=8'} + hook-std@3.0.0: + resolution: {integrity: sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} hosted-git-info@7.0.1: resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} @@ -1002,10 +1044,6 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} - minimatch@9.0.3: - resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} - engines: {node: '>=16 || 14 >=14.17'} - minimatch@9.0.4: resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==} engines: {node: '>=16 || 14 >=14.17'} @@ -1076,14 +1114,13 @@ packages: resolution: {integrity: sha512-yAyTfdeNJGGBFxWdzSKCBYxs5FxLbCg5X5Q4ets974hcQzG1+qCxvIyOo4j2Ry6MUlhWVMX4OoYDefAIIwupjw==} engines: {node: '>= 10.13'} - node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + + node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} node-gyp@10.0.1: resolution: {integrity: sha512-gg3/bHehQfZivQVfqIyy8wTdSymF9yTyP4CJifK73imyNMU8AIGQE2pUa7dNWfmMeG9cDVF2eehiRMv0LC1iAg==} @@ -1301,11 +1338,6 @@ packages: scheduler@0.23.0: resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==} - semver@7.5.4: - resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} - engines: {node: '>=10'} - hasBin: true - semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -1428,21 +1460,32 @@ packages: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} - to-readable-stream@2.1.0: - resolution: {integrity: sha512-o3Qa6DGg1CEXshSdvWNX2sN4QHqg03SPq7U6jPXRahlQdl5dK8oXjkU/2/sGrnOZKeGV1zLSO8qPwyKklPPE7w==} - engines: {node: '>=8'} + to-readable-stream@4.0.0: + resolution: {integrity: sha512-b39z6yUzkmzZXTNlKZoLo1kIPXJDioGSMMX4ydudA3XX8M/AjcsPdJRVz2zbrGZoekhkMlz6qYok2iVdlMH/yQ==} + engines: {node: '>=18'} to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - trivial-deferred@2.0.0: resolution: {integrity: sha512-iGbM7X2slv9ORDVj2y2FFUq3cP/ypbtu2nQ8S38ufjL0glBABvmR9pTdsib1XtS2LUhhLMbelaBUaf/s5J3dSw==} engines: {node: '>= 8'} + ts-node@10.9.2: + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + tshy@1.14.0: resolution: {integrity: sha512-YiUujgi4Jb+t2I48LwSRzHkBpniH9WjjktNozn+nlsGmVemKSjDNY7EwBRPvPCr5zAC/3ITAYWH9Z7kUinGSrw==} engines: {node: 16 >=16.17 || 18 >=18.15.0 || >=20.6.1} @@ -1520,11 +1563,9 @@ packages: walk-up-path@3.0.1: resolution: {integrity: sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==} - webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - - whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} @@ -1589,6 +1630,10 @@ packages: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -1691,7 +1736,7 @@ snapshots: '@tsconfig/node14': 14.1.0 '@tsconfig/node16': 16.1.1 '@tsconfig/node18': 18.2.2 - '@tsconfig/node20': 20.1.2 + '@tsconfig/node20': 20.1.4 '@types/node': 20.12.7 acorn: 8.11.2 acorn-walk: 8.3.0 @@ -1707,7 +1752,7 @@ snapshots: '@tsconfig/node14': 14.1.0 '@tsconfig/node16': 16.1.1 '@tsconfig/node18': 18.2.2 - '@tsconfig/node20': 20.1.2 + '@tsconfig/node20': 20.1.4 '@types/node': 20.12.7 acorn: 8.11.2 acorn-walk: 8.3.0 @@ -2145,20 +2190,30 @@ snapshots: dependencies: '@tapjs/core': 1.5.2(@types/node@20.12.7)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@tsconfig/node10@1.0.11': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + '@tsconfig/node14@14.1.0': {} + '@tsconfig/node16@1.0.4': {} + '@tsconfig/node16@16.1.1': {} '@tsconfig/node18@18.2.2': {} - '@tsconfig/node20@20.1.2': {} + '@tsconfig/node20@20.1.4': {} + + '@tsconfig/strictest@2.0.5': {} '@tufjs/canonical-json@2.0.0': {} '@tufjs/models@2.0.0': dependencies: '@tufjs/canonical-json': 2.0.0 - minimatch: 9.0.3 + minimatch: 9.0.4 '@types/istanbul-lib-coverage@2.0.6': {} @@ -2342,6 +2397,8 @@ snapshots: convert-to-spaces@2.0.1: {} + create-require@1.1.1: {} + cross-env@7.0.3: dependencies: cross-spawn: 7.0.3 @@ -2352,6 +2409,8 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + data-uri-to-buffer@4.0.1: {} + debug@4.3.4: dependencies: ms: 2.1.2 @@ -2389,6 +2448,11 @@ snapshots: exponential-backoff@3.1.1: {} + fetch-blob@3.2.0: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + fill-range@7.0.1: dependencies: to-regex-range: 5.0.1 @@ -2414,6 +2478,10 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 + formdata-polyfill@4.0.10: + dependencies: + fetch-blob: 3.2.0 + fromentries@1.3.2: {} fs-minipass@2.1.0: @@ -2443,7 +2511,7 @@ snapshots: dependencies: foreground-child: 3.1.1 jackspeak: 2.3.6 - minimatch: 9.0.3 + minimatch: 9.0.4 minipass: 7.0.4 path-scurry: 1.10.1 @@ -2464,7 +2532,7 @@ snapshots: dependencies: function-bind: 1.1.2 - hook-std@2.0.0: {} + hook-std@3.0.0: {} hosted-git-info@7.0.1: dependencies: @@ -2495,7 +2563,7 @@ snapshots: ignore-walk@6.0.3: dependencies: - minimatch: 9.0.3 + minimatch: 9.0.4 imurmurhash@0.1.4: {} @@ -2633,7 +2701,7 @@ snapshots: lru-cache@10.0.2: dependencies: - semver: 7.5.4 + semver: 7.6.0 lru-cache@6.0.0: dependencies: @@ -2675,10 +2743,6 @@ snapshots: dependencies: brace-expansion: 1.1.11 - minimatch@9.0.3: - dependencies: - brace-expansion: 2.0.1 - minimatch@9.0.4: dependencies: brace-expansion: 2.0.1 @@ -2751,11 +2815,13 @@ snapshots: transitivePeerDependencies: - supports-color - node-fetch@2.7.0(encoding@0.1.13): + node-domexception@1.0.0: {} + + node-fetch@3.3.2: dependencies: - whatwg-url: 5.0.0 - optionalDependencies: - encoding: 0.1.13 + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 node-gyp@10.0.1: dependencies: @@ -2993,10 +3059,6 @@ snapshots: dependencies: loose-envify: 1.4.0 - semver@7.5.4: - dependencies: - lru-cache: 6.0.0 - semver@7.6.0: dependencies: lru-cache: 6.0.0 @@ -3181,16 +3243,32 @@ snapshots: glob: 7.2.3 minimatch: 3.1.2 - to-readable-stream@2.1.0: {} + to-readable-stream@4.0.0: {} to-regex-range@5.0.1: dependencies: is-number: 7.0.0 - tr46@0.0.3: {} - trivial-deferred@2.0.0: {} + ts-node@10.9.2(@types/node@20.12.7)(typescript@5.4.5): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.11 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 20.12.7 + acorn: 8.11.2 + acorn-walk: 8.3.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.4.5 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + tshy@1.14.0: dependencies: chalk: 5.3.0 @@ -3264,12 +3342,7 @@ snapshots: walk-up-path@3.0.1: {} - webidl-conversions@3.0.1: {} - - whatwg-url@5.0.0: - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 + web-streams-polyfill@3.3.3: {} which@2.0.2: dependencies: @@ -3321,6 +3394,8 @@ snapshots: y18n: 5.0.8 yargs-parser: 21.1.1 + yn@3.1.1: {} + yocto-queue@0.1.0: {} yoga-wasm-web@0.3.3: {} diff --git a/src/main.ts b/src/main.ts index 879d8592..eda9e030 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,11 @@ import { unlinkSync } from 'node:fs'; import { arch, platform } from 'node:os'; +import { resolve } from 'node:path'; import { chdir } from 'node:process'; +import { fileURLToPath } from 'node:url'; import { debug, error, info, setFailed, warning } from '@actions/core'; import { exec } from '@actions/exec'; -import type { ExecOptions } from '@actions/exec/lib/interfaces'; +import type { ExecOptions } from '@actions/exec/lib/interfaces.js'; import { context } from '@actions/github'; import * as glob from '@actions/glob'; import { @@ -12,7 +14,7 @@ import { parsePathAndFormat, verifyChecksum, verifySignature, -} from './utils'; +} from './utils.js'; const PLATFORM = platform(); // REFER: https://docs.codeclimate.com/docs/configuring-test-coverage#locations-of-pre-built-binaries @@ -73,7 +75,7 @@ export function prepareEnv() { process.env.GITHUB_EVENT_NAME && SUPPORTED_GITHUB_EVENTS.includes(process.env.GITHUB_EVENT_NAME) ) { - env.GIT_BRANCH = process.env.GITHUB_HEAD_REF || env.GIT_BRANCH; // Report correct branch for PRs (See https://github.com/paambaati/codeclimate-action/issues/86) + env.GIT_BRANCH = process.env.GITHUB_HEAD_REF || (env.GIT_BRANCH as string); // Report correct branch for PRs (See https://github.com/paambaati/codeclimate-action/issues/86) env.GIT_COMMIT_SHA = context.payload.pull_request?.head?.sha; // Report correct SHA for the head branch (See https://github.com/paambaati/codeclimate-action/issues/140) } @@ -250,7 +252,7 @@ export async function run( const parts: Array = []; for (const i in coverageLocations) { const { format: type, pattern: location } = parsePathAndFormat( - coverageLocations[i], + coverageLocations[i] as string, ); if (!type) { const err = new Error(`Invalid formatter type ${type}`); @@ -356,7 +358,10 @@ export async function run( } /* c8 ignore start */ -if (require.main === module) { +const pathToThisFile = resolve(fileURLToPath(import.meta.url)); +const pathPassedToNode = resolve(process.argv[1] as string); +const isThisFileBeingRunViaCLI = pathToThisFile.includes(pathPassedToNode); +if (isThisFileBeingRunViaCLI) { const coverageCommand = getOptionalString( 'coverageCommand', DEFAULT_COVERAGE_COMMAND, diff --git a/src/utils.ts b/src/utils.ts index cc8115f2..be952d00 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -4,7 +4,13 @@ import { platform } from 'node:os'; import { promisify } from 'node:util'; import { getInput } from '@actions/core'; import fetch from 'node-fetch'; -import { createMessage, readKey, readSignature, verify } from 'openpgp'; +import { + type VerificationResult, + createMessage, + readKey, + readSignature, + verify, +} from 'openpgp'; const readFileAsync = promisify(readFile); type ReadFileAsyncOptions = Omit[1], 'string'>; @@ -44,11 +50,19 @@ export function downloadToFile( mode = 0o755, ): Promise { return new Promise((resolve, reject) => { + const controller = new AbortController(); + const timeout = setTimeout( + () => { + controller.abort(); + }, + // Timeout in 2 minutes. + 2 * 60 * 1000, + ); try { fetch(url, { redirect: 'follow', follow: 5, - timeout: 2 * 60 * 1000, // Timeout in 2 minutes. + signal: controller.signal, }) .then((response) => { if (response.status < 200 || response.status > 299) { @@ -57,7 +71,7 @@ export function downloadToFile( ); } const writer = createWriteStream(file, { mode }); - response.body.pipe(writer); + response.body?.pipe(writer); writer.on('close', () => { return resolve(); }); @@ -67,6 +81,8 @@ export function downloadToFile( }); } catch (err) { return reject(err); + } finally { + clearTimeout(timeout); } }); } @@ -132,10 +148,8 @@ export async function verifyChecksum( ): Promise { const binaryChecksum = await getFileChecksum(originalFile, algorithm); const declaredChecksumFileContents = await getFileContents(checksumFile); - const declaredChecksum = declaredChecksumFileContents - .toString() - .trim() - .split(/\s+/)[0]; + const declaredChecksum = + declaredChecksumFileContents.toString().trim().split(/\s+/)[0] || ''; try { return timingSafeEqual( Buffer.from(binaryChecksum), @@ -178,7 +192,7 @@ export async function verifySignature( signature, verificationKeys: publicKey, }); - const { verified } = verificationResult.signatures[0]; + const { verified } = verificationResult.signatures[0] as VerificationResult; try { await verified; return true; @@ -226,9 +240,12 @@ export function parsePathAndFormat(coverageConfigLine: string): { platform() === 'win32' && (coverageConfigLine.match(/:/g) || []).length > 1 ) { - lineParts = [lineParts.slice(0, -1).join(':'), lineParts.slice(-1)[0]]; + lineParts = [ + lineParts.slice(0, -1).join(':'), + lineParts.slice(-1)[0] as string, + ]; } - const format = lineParts.slice(-1)[0]; - const pattern = lineParts.slice(0, -1)[0]; + const format = lineParts.slice(-1)[0] as string; + const pattern = lineParts.slice(0, -1)[0] as string; return { format, pattern }; } diff --git a/test/integration.test.ts b/test/integration.test.ts index 9e5ac79d..faf751b5 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -1,14 +1,13 @@ import { unlinkSync } from 'node:fs'; import { EOL, arch, platform } from 'node:os'; -import { default as hookStd } from 'hook-std'; -import t from 'tap'; +import { hookStd } from 'hook-std'; import { DOWNLOAD_URL, EXECUTABLE, FILE_ARTIFACTS, downloadAndRecord, verifyChecksumAndSignature, -} from '../src/main'; +} from '../src/main.js'; t.test( '🧪 verifyChecksumAndSignature() should download the CC reporter and pass all validations (happy path).', diff --git a/test/main.test.ts b/test/main.test.ts index 5b4afbd3..d0ee8fac 100644 --- a/test/main.test.ts +++ b/test/main.test.ts @@ -9,14 +9,14 @@ import { join as joinPath } from 'node:path'; import { promisify } from 'node:util'; import { context } from '@actions/github'; import * as glob from '@actions/glob'; -import { default as hookStd } from 'hook-std'; +import { hookStd } from 'hook-std'; import nock from 'nock'; import sinon from 'sinon'; import t from 'tap'; import toReadableStream from 'to-readable-stream'; import which from 'which'; -import { CODECLIMATE_GPG_PUBLIC_KEY_ID, prepareEnv, run } from '../src/main'; -import * as utils from '../src/utils'; +import { CODECLIMATE_GPG_PUBLIC_KEY_ID, prepareEnv, run } from '../src/main.js'; +import * as utils from '../src/utils.js'; /** * Dev Notes diff --git a/test/utils.test.ts b/test/utils.test.ts index 13ed24c5..70acecc5 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -8,7 +8,7 @@ import { areObjectsEqual, downloadToFile, parsePathAndFormat, -} from '../src/utils'; +} from '../src/utils.js'; const stat = promisify(statCallback); diff --git a/tsconfig.json b/tsconfig.json index 06fd76e0..f88297a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,60 +1,13 @@ { "$schema": "https://json.schemastore.org/tsconfig", + "extends": [ + "@tsconfig/node20/tsconfig.json", + "@tsconfig/strictest/tsconfig.json" + ], "compilerOptions": { - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "ES2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "skipLibCheck": true, /* Skip type checking all .d.ts files. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./lib", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - "rootDirs": ["./src", "./test"], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "outDir": "./lib", /* Redirect output structure to the directory. */ + "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "rootDirs": ["./src", "./test"] /* List of root folders whose combined content represents the structure of the project at runtime. */ }, "exclude": [ "node_modules",