From 7f3215f030aa85d842cf046a2baccb524504e350 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Mon, 4 Dec 2023 02:35:47 +1100 Subject: [PATCH 1/7] Upgrade typescript to 5.3 --- .babelrc | 2 +- buildprocess/configureWebpack.js | 2 +- package.json | 14 +++++++------- tsconfig-node.json | 22 +++------------------- tsconfig.json | 14 ++++++++++++-- 5 files changed, 24 insertions(+), 30 deletions(-) diff --git a/.babelrc b/.babelrc index fcc5468eca1..f3d11ffe5a0 100644 --- a/.babelrc +++ b/.babelrc @@ -7,7 +7,7 @@ "useBuiltIns": "usage" } ], - "@babel/preset-react", + ["@babel/preset-react", { "runtime": "automatic" }], ["@babel/typescript", { "allowNamespaces": true }] ], "plugins": [ diff --git a/buildprocess/configureWebpack.js b/buildprocess/configureWebpack.js index b4ca392a087..081e14dce6b 100644 --- a/buildprocess/configureWebpack.js +++ b/buildprocess/configureWebpack.js @@ -126,7 +126,7 @@ function configureWebpack( useBuiltIns: "usage" } ], - "@babel/preset-react", + ["@babel/preset-react", { runtime: "automatic" }], ["@babel/typescript", { allowNamespaces: true }] ], plugins: [ diff --git a/package.json b/package.json index 8cc0a7d79cd..89754f9dc4b 100644 --- a/package.json +++ b/package.json @@ -15,13 +15,13 @@ "@types/node": "^18.15.11" }, "dependencies": { - "@babel/core": "^7.22.9", - "@babel/parser": "^7.22.7", + "@babel/core": "^7.23.5", + "@babel/parser": "^7.23.5", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-decorators": "^7.22.7", "@babel/plugin-proposal-object-rest-spread": "^7.20.7", - "@babel/preset-env": "^7.22.9", - "@babel/preset-react": "^7.22.5", + "@babel/preset-env": "^7.23.5", + "@babel/preset-react": "^7.23.3", "@babel/preset-typescript": "^7.22.5", "@mapbox/geojson-merge": "^1.1.1", "@mapbox/point-geometry": "^0.1.0", @@ -177,7 +177,7 @@ "ts-essentials": "^5.0.0", "ts-loader": "^5.3.3", "ts-node": "^5.0.1", - "typescript": "^4.9.5", + "typescript": "^5.3.2", "urijs": "^1.18.12", "url-loader": "^1.1.2", "webpack": "~4.46.0", @@ -186,7 +186,7 @@ "worker-loader": "^2.0.0" }, "devDependencies": { - "@babel/eslint-parser": "^7.12.16", + "@babel/eslint-parser": "^7.23.3", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@types/dateformat": "^3.0.1", "@types/node": "^18.15.11", @@ -213,7 +213,7 @@ "karma-jasmine": "^1.1.0", "karma-opera-launcher": "^1.0.0", "karma-safari-launcher": "^1.0.0", - "karma-spec-reporter": "^0.0.32", + "karma-spec-reporter": "^0.0.36", "klaw-sync": "^4.0.0", "minimist": "^1.2.8", "node-notifier": "^5.1.2", diff --git a/tsconfig-node.json b/tsconfig-node.json index 81d91c9ee3e..0b80b097163 100644 --- a/tsconfig-node.json +++ b/tsconfig-node.json @@ -1,25 +1,9 @@ // This tsconfig is used to build the model layer only for use in a node.js app. // Build with ./node_modules/.bin/tsc -p tsconfig-models.json { + "extends": "./tsconfig.json", "compilerOptions": { - "target": "es2019", - "experimentalDecorators": true, - "module": "esNext", - "moduleResolution": "node", - "sourceMap": true, - "strict": true, - "allowJs": true, - "jsx": "react", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "useDefineForClassFields": true, // required for mobx6 - https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties "outDir": "dist", - "resolveJsonModule": true, - "typeRoots": [ - "./lib/ThirdParty" - //"./node_modules/@types", - //"../node_modules/@types" - ], "types": [ "terriajs-cesium", "mapbox__geojson-merge", @@ -28,8 +12,8 @@ "pmtiles", "terriajs-html2canvas", "urijs", - "styled-components" // eventually it will be required anyway for SSR. - //"react" + "styled-components", // eventually it will be required anyway for SSR. + "react" ] }, "include": [ diff --git a/tsconfig.json b/tsconfig.json index cdf2ea1f355..a9c5877fa40 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,13 +7,23 @@ "sourceMap": true, "strict": true, "allowJs": true, - "jsx": "preserve", + "jsx": "react-jsx", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "useDefineForClassFields": true, // required for mobx6 - https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties "outDir": "ts-out", "resolveJsonModule": true, - "typeRoots": ["./lib/ThirdParty/**/*.d.ts"], + "typeRoots": [ + "./lib/ThirdParty/", + "./node_modules/", + "./node_modules/@types/", + "../node_modules/", + "../node_modules/@types/", + "../../node_modules/", + "../../node_modules/@types/", + "../../../node_modules/", + "../../../node_modules/@types/" + ], "types": ["terriajs-cesium"] }, "include": [ From 6ad66bff88cc71e84a631da1f07cc315da7e460d Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Mon, 4 Dec 2023 02:45:58 +1100 Subject: [PATCH 2/7] Fix type error --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 89754f9dc4b..bbafeea243c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ }, "resolutions": { "colors": "1.4.0", - "@types/node": "^18.15.11" + "@types/node": "^18.15.11", + "@types/css-font-loading-module": "^0.0.9" }, "dependencies": { "@babel/core": "^7.23.5", From 262bd4230a4096783af7d6a71dc339f58f58fe91 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Mon, 4 Dec 2023 13:50:07 +1100 Subject: [PATCH 3/7] Udpate ignore files --- .gitignore | 2 ++ .prettierignore | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 96f50f40ded..5b4206bdf97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +# Update .prettierignore whenever this file changes docs/ node_modules/ .idea/ @@ -17,6 +18,7 @@ package-lock.json *.swp dist .history/ +ts-out/ # Catalog index generation files catalog-index*.json diff --git a/.prettierignore b/.prettierignore index 62a39ac9c00..54c6fab53a1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -20,6 +20,7 @@ package-lock.json *.swp dist .history/ +ts-out/ # Catalog index generation files catalog-index*.json From 21c5f0cbef8879adc92ca5611fb1c5ccc2486b41 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Mon, 4 Dec 2023 13:53:01 +1100 Subject: [PATCH 4/7] Downgrade to TS 5.2 while we work out super access --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bbafeea243c..dcb2454e1e4 100644 --- a/package.json +++ b/package.json @@ -178,7 +178,7 @@ "ts-essentials": "^5.0.0", "ts-loader": "^5.3.3", "ts-node": "^5.0.1", - "typescript": "^5.3.2", + "typescript": "~5.2.0", "urijs": "^1.18.12", "url-loader": "^1.1.2", "webpack": "~4.46.0", From 3bfeef78fa49200ad121beaeec5c0c196b29e67f Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Mon, 4 Dec 2023 15:17:38 +1100 Subject: [PATCH 5/7] Fix type error --- lib/ReactViews/Map/Panels/SettingPanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ReactViews/Map/Panels/SettingPanel.tsx b/lib/ReactViews/Map/Panels/SettingPanel.tsx index f8b48c1b0a1..3136840b204 100644 --- a/lib/ReactViews/Map/Panels/SettingPanel.tsx +++ b/lib/ReactViews/Map/Panels/SettingPanel.tsx @@ -318,7 +318,7 @@ class SettingPanel extends React.Component { } onClick={(event) => this.selectBaseMap(baseMap.item, event)} onMouseEnter={this.mouseEnterBaseMap.bind(this, baseMap)} - onMouseLeave={this.mouseLeaveBaseMap.bind(this, baseMap)} + onMouseLeave={this.mouseLeaveBaseMap.bind(this)} onFocus={this.mouseEnterBaseMap.bind(this, baseMap)} > {baseMap.item === this.props.terria.mainViewer.baseMap ? ( From 0d21ba904774dca6164880ec69e20e2b099b1090 Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Wed, 6 Dec 2023 13:33:19 +1100 Subject: [PATCH 6/7] Update changelog --- CHANGES.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7e9d8b264aa..8a7023a0362 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,11 @@ # Change Log -#### next release (8.4.1) +#### next release (8.5.0) +- **Breaking changes:** + - Upgrade TypeScript to 5.2 + - Switch Babel configuration to new JSX transform +- Improve tsconfig files - Fix a bug where `DragPoints` was interfering with pedstrian mode mouse movements. - Update `webpack` to `4.47.0` to support Node >= 18 without extra command line parameters. - [The next improvement] From 2cf8f4a5c29ebade5c3f8b3fdf292aa649b14fed Mon Sep 17 00:00:00 2001 From: Stephen Davies Date: Wed, 6 Dec 2023 15:24:18 +1100 Subject: [PATCH 7/7] Update tsconfig-node.json Co-authored-by: Lawrence Owen --- tsconfig-node.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig-node.json b/tsconfig-node.json index 0b80b097163..37123944db3 100644 --- a/tsconfig-node.json +++ b/tsconfig-node.json @@ -1,5 +1,5 @@ // This tsconfig is used to build the model layer only for use in a node.js app. -// Build with ./node_modules/.bin/tsc -p tsconfig-models.json +// Build with ./node_modules/.bin/tsc -p tsconfig-node.json { "extends": "./tsconfig.json", "compilerOptions": {