From dc34fd8743172dd86098213b124cd13ad4f00dca Mon Sep 17 00:00:00 2001 From: Wojciech Pawlik Date: Fri, 22 Sep 2023 10:54:52 +0200 Subject: [PATCH] Upgrade to TypeScript 5.2 --- package-lock.json | 68 +++++++++++-------------------------------- package.json | 6 ++-- scripts/ts-version.ts | 17 +++++++++++ scripts/update.sh | 21 ++----------- src/deps.deno.ts | 2 +- 5 files changed, 40 insertions(+), 74 deletions(-) create mode 100755 scripts/ts-version.ts diff --git a/package-lock.json b/package-lock.json index d081028..d49b61c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,53 +1,28 @@ { "name": "deno2node", - "version": "1.9.0", + "version": "1.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "deno2node", - "version": "1.9.0", + "version": "1.10.0", "license": "MIT", "dependencies": { - "@deno/shim-deno-test": "^0.4.0", - "ts-morph": "^19.0.0" + "ts-morph": "^20.0.0" }, "bin": { "deno2node": "lib/cli.js" }, "devDependencies": { - "@fromdeno/test": "^0.4.0", "@types/node": "^18.15.11", - "deno-bin": "~1.35.0", + "deno-bin": "~1.37.0", "fast-check": "^3.10.0" }, "engines": { "node": ">=14.13.1" } }, - "node_modules/@deno/shim-deno-test": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@deno/shim-deno-test/-/shim-deno-test-0.4.0.tgz", - "integrity": "sha512-oYWcD7CpERZy/TXMTM9Tgh1HD/POHlbY9WpzmAk+5H8DohcxG415Qws8yLGlim3EaKBT2v3lJv01x4G0BosnaQ==" - }, - "node_modules/@fromdeno/test": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@fromdeno/test/-/test-0.4.0.tgz", - "integrity": "sha512-NNkwiy9n1DvHx06KyhHPYHk8BeVVluJyBQn2JZM/eT9zZ+cPQ25pT1C+pU1m99J5Z97vN83YfMrHlz9PFBUb6g==", - "dev": true, - "dependencies": { - "mri": "^1.1.6" - }, - "bin": { - "fdt": "src/cli.mjs" - }, - "engines": { - "node": ">=14.13.1" - }, - "peerDependencies": { - "@deno/shim-deno-test": "<0.5.0" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -81,9 +56,9 @@ } }, "node_modules/@ts-morph/common": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.20.0.tgz", - "integrity": "sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.21.0.tgz", + "integrity": "sha512-ES110Mmne5Vi4ypUKrtVQfXFDtCsDXiUiGxF6ILVlE90dDD4fdpC1LSjydl/ml7xJWKSDZwUYD2zkOePMSrPBA==", "dependencies": { "fast-glob": "^3.2.12", "minimatch": "^7.4.3", @@ -136,9 +111,9 @@ "integrity": "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==" }, "node_modules/deno-bin": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/deno-bin/-/deno-bin-1.35.0.tgz", - "integrity": "sha512-h4s/LgcjnNMXkoRraBXm8nlEv/JCTTNaC3PwB/Zqxz/PtHQscwLMEDDPrwzLSJfpctcPmhKf9JxoPLL7YmnfbA==", + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/deno-bin/-/deno-bin-1.37.0.tgz", + "integrity": "sha512-sPXM+HdgguFQ4dPGK0zOedMkAIivuKTJUVvQDe2Oz4dXkoy4w9c36Qw8Mnb5dfsUHYtZn0JaG/9y5kDe0R18yA==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -173,9 +148,9 @@ } }, "node_modules/fast-glob": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", - "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -312,15 +287,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", @@ -415,11 +381,11 @@ } }, "node_modules/ts-morph": { - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-19.0.0.tgz", - "integrity": "sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ==", + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-20.0.0.tgz", + "integrity": "sha512-JVmEJy2Wow5n/84I3igthL9sudQ8qzjh/6i4tmYCm6IqYyKFlNbJZi7oBdjyqcWSWYRu3CtL0xbT6fS03ESZIg==", "dependencies": { - "@ts-morph/common": "~0.20.0", + "@ts-morph/common": "~0.21.0", "code-block-writer": "^12.0.0" } } diff --git a/package.json b/package.json index 8d0a06f..423def4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deno2node", - "version": "1.9.0", + "version": "1.10.0", "description": "`tsc` replacement for transpiling Deno libraries to run on Node.js.", "type": "module", "bin": { @@ -43,11 +43,11 @@ "node": ">=14.13.1" }, "dependencies": { - "ts-morph": "^19.0.0" + "ts-morph": "^20.0.0" }, "devDependencies": { "@types/node": "^18.15.11", - "deno-bin": "~1.36.0", + "deno-bin": "~1.37.0", "fast-check": "^3.10.0" } } diff --git a/scripts/ts-version.ts b/scripts/ts-version.ts new file mode 100755 index 0000000..9b4fa0d --- /dev/null +++ b/scripts/ts-version.ts @@ -0,0 +1,17 @@ +#!node_modules/.bin/deno run +import { ts } from "../src/deps.deno.ts"; + +const minor = (version: string) => version.split(".", 2).join("."); +const deno_s = minor(Deno.version.typescript); +const ts_morph_s = minor(ts.version); + +if (deno_s !== ts_morph_s) { + console.error( + "Deno's TypeScript version (%s) doesn't match ts-morph's (%s).", + deno_s, + ts_morph_s, + ); + Deno.exit(1); +} + +console.info(ts_morph_s); diff --git a/scripts/update.sh b/scripts/update.sh index c81c526..d55f6fa 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,7 +1,6 @@ #!/bin/bash set -eu -export PATH="$PWD/node_modules/.bin:$PATH" export NPM_CONFIG_COMMIT_HOOKS=false git diff --quiet || { @@ -11,30 +10,14 @@ git diff --quiet || { if npm outdated ts-morph --json | jq --exit-status '."ts-morph" | .latest == .wanted' >/dev/null; then echo 'ts-morph already up to date.' - exit + exit 0 fi -npm install --ignore-scripts -oldTsVersion="$(deno eval --print 'Deno.version.typescript.match(/^\d+\.\d+/, "")[0]')" npm install --save-dev --save-prefix='~' deno-bin@latest -newTsVersion="$(deno eval --print 'Deno.version.typescript.match(/^\d+\.\d+/, "")[0]')" - -if [ "$oldTsVersion" == "$newTsVersion" ]; then - echo 'Deno already up to date.' - git restore 'package*.json' - exit -fi - npm install-test ts-morph@latest ! git diff --quiet src/deps.deno.ts src/cli.ts --noEmit -tsMorphTsVersion=$(node --print 'require("ts-morph").ts.version.match(/^\d+\.\d+/, "")[0]') - -if [[ "$tsMorphTsVersion" != "$newTsVersion" ]]; then - echo "TypeScript version mismatch! Deno's: $newTsVersion, ts-morph's: $tsMorphTsVersion" - exit 1 -fi - +newTsVersion=$(scripts/ts-version.ts || exit 0) git add src/deps.deno.ts npm version minor --force --message "Upgrade to TypeScript ${newTsVersion}" diff --git a/src/deps.deno.ts b/src/deps.deno.ts index 57adaa1..3fa4ad8 100644 --- a/src/deps.deno.ts +++ b/src/deps.deno.ts @@ -1,3 +1,3 @@ // Deno-only, see https://doc.deno.land/https/deno.land/x/deno2node/src/mod.ts#deno2node // Auto-updated in `dependencies` script -export * from "https://deno.land/x/ts_morph@19.0.0/mod.ts"; +export * from "https://deno.land/x/ts_morph@20.0.0/mod.ts";