From 662fc22e912b495f8e9442eaa8e739ac86edbfa6 Mon Sep 17 00:00:00 2001 From: Mert Karaca Date: Fri, 5 Jul 2024 12:34:26 +0200 Subject: [PATCH 1/3] Add @types/react to resolutions and overrides --- .../__tests__/outputs/package_native.json-js-unit.json | 4 ++-- .../packages/__tests__/outputs/package_native.json-js.json | 4 ++-- .../__tests__/outputs/package_native.json-ts-unit.json | 6 ++++-- .../packages/__tests__/outputs/package_native.json-ts.json | 6 ++++-- .../packages/__tests__/outputs/package_web.json-js-e2e.json | 4 ++-- .../__tests__/outputs/package_web.json-js-unit-e2e.json | 4 ++-- .../__tests__/outputs/package_web.json-js-unit.json | 4 ++-- .../packages/__tests__/outputs/package_web.json-js.json | 4 ++-- .../packages/__tests__/outputs/package_web.json-ts-e2e.json | 6 ++++-- .../__tests__/outputs/package_web.json-ts-unit-e2e.json | 6 ++++-- .../__tests__/outputs/package_web.json-ts-unit.json | 6 ++++-- .../packages/__tests__/outputs/package_web.json-ts.json | 6 ++++-- .../app/templates/packages/package_native.json.ejs | 6 ++++-- .../generators/app/templates/packages/package_web.json.ejs | 6 ++++-- packages/pluggable-widgets-tools/package-lock.json | 2 +- 15 files changed, 45 insertions(+), 29 deletions(-) diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js-unit.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js-unit.json index c9b8bd04..0b3f09ca 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js-unit.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js-unit.json @@ -33,11 +33,11 @@ }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js.json index ed5b4ba5..c6e9335b 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-js.json @@ -28,11 +28,11 @@ }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts-unit.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts-unit.json index ae52e489..69114db8 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts-unit.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts-unit.json @@ -36,11 +36,13 @@ }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts.json index 7596e097..7b6070fb 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_native.json-ts.json @@ -29,11 +29,13 @@ }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-e2e.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-e2e.json index c08a895d..8227b35c 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-e2e.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-e2e.json @@ -33,11 +33,11 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit-e2e.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit-e2e.json index 53dde976..29d9a726 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit-e2e.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit-e2e.json @@ -35,11 +35,11 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit.json index 5a45549e..5fe0652a 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js-unit.json @@ -33,11 +33,11 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js.json index 81a61e58..6bf68617 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-js.json @@ -31,11 +31,11 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-e2e.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-e2e.json index 7a9fec89..d1c5067d 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-e2e.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-e2e.json @@ -36,11 +36,13 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit-e2e.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit-e2e.json index 348e1329..d89422a0 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit-e2e.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit-e2e.json @@ -40,11 +40,13 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit.json index 70f543f4..e1bf3de7 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts-unit.json @@ -37,11 +37,13 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts.json b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts.json index 29979b70..3adcec60 100644 --- a/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts.json +++ b/packages/generator-widget/generators/app/templates/packages/__tests__/outputs/package_web.json-ts.json @@ -32,11 +32,13 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0", + "@types/react": "^18.2.0", "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/package_native.json.ejs b/packages/generator-widget/generators/app/templates/packages/package_native.json.ejs index 3d455bea..c1cb4bef 100644 --- a/packages/generator-widget/generators/app/templates/packages/package_native.json.ejs +++ b/packages/generator-widget/generators/app/templates/packages/package_native.json.ejs @@ -36,11 +36,13 @@ }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0",<% if (isLanguageTS) { %> + "@types/react": "^18.2.0",<% } %> "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0",<% if (isLanguageTS) { %> + "@types/react": "^18.2.0",<% } %> "react-native": "0.72.7" } } diff --git a/packages/generator-widget/generators/app/templates/packages/package_web.json.ejs b/packages/generator-widget/generators/app/templates/packages/package_web.json.ejs index ef29f911..0c1f528a 100644 --- a/packages/generator-widget/generators/app/templates/packages/package_web.json.ejs +++ b/packages/generator-widget/generators/app/templates/packages/package_web.json.ejs @@ -40,11 +40,13 @@ "classnames": "^2.2.6" }, "resolutions": { - "react": "18.2.0", + "react": "^18.2.0",<% if (isLanguageTS) { %> + "@types/react": "^18.2.0",<% } %> "react-native": "0.72.7" }, "overrides": { - "react": "18.2.0", + "react": "^18.2.0",<% if (isLanguageTS) { %> + "@types/react": "^18.2.0",<% } %> "react-native": "0.72.7" } } diff --git a/packages/pluggable-widgets-tools/package-lock.json b/packages/pluggable-widgets-tools/package-lock.json index 1c977fbe..a228b83e 100644 --- a/packages/pluggable-widgets-tools/package-lock.json +++ b/packages/pluggable-widgets-tools/package-lock.json @@ -17038,7 +17038,7 @@ "node": ">=16" }, "peerDependencies": { - "react": "18.2.0" + "react": "^18.2.0" } }, "node_modules/react-native/node_modules/@jest/types": { From da4d57eed37530923ca38e29ab36214d9f232f6c Mon Sep 17 00:00:00 2001 From: Mert Karaca Date: Fri, 5 Jul 2024 12:49:22 +0200 Subject: [PATCH 2/3] Add release notes --- packages/generator-widget/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/generator-widget/CHANGELOG.md b/packages/generator-widget/CHANGELOG.md index bd83835f..39c83c44 100644 --- a/packages/generator-widget/CHANGELOG.md +++ b/packages/generator-widget/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +- We added `@types/react` package and aligned its version with the `react` package to ^18.2.0 in resolutions and overrides for the Yeoman generator. + ## [10.7.2] - 2024-03-07 ### Changed From 7adf7cb734dbb8d6c1dbdf3f3623a8a53fcbc1e7 Mon Sep 17 00:00:00 2001 From: Arjo Bruijnes Date: Tue, 9 Jul 2024 14:24:43 +0200 Subject: [PATCH 3/3] Rewrite release note to motivate the change --- packages/generator-widget/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/generator-widget/CHANGELOG.md b/packages/generator-widget/CHANGELOG.md index 39c83c44..516dcd9b 100644 --- a/packages/generator-widget/CHANGELOG.md +++ b/packages/generator-widget/CHANGELOG.md @@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] -- We added `@types/react` package and aligned its version with the `react` package to ^18.2.0 in resolutions and overrides for the Yeoman generator. +### Changed + +- We updated the default overrides (and resolutions) for generated widgets to ensure consistent React types with `@mendix/pluggable-widgets-tools`. This fixes errors like "_Type Element is not assignable to type ReactElement_". ## [10.7.2] - 2024-03-07