Skip to content

Commit bf01d71

Browse files
[MOO-961] Auto update & patch known outdated dependencies (#39)
Auto migration with known outdated dependencies, including native ones
2 parents bbd158e + b1faf70 commit bf01d71

File tree

15 files changed

+377
-83
lines changed

15 files changed

+377
-83
lines changed

packages/generator-widget/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9-
- We've updated our templates to support the new version of Pluggable Widgets Tools containing new React and React Native versions. This is necessary due to breaking changes introduced in Studio Pro 9.24.0.
9+
### Changed
10+
11+
- We've updated our templates to support the new version of Pluggable Widgets Tools containing new React and React Native versions. This is necessary due to breaking changes introduced in Studio Pro 9.24.0.
12+
13+
- We've updated our templates to remove `@types/react`, `@types/react-dom` and `@types/react-native` from the generated widget's package.json since those dependencies will be part of the Pluggable Widgets Tools 9.24.
1014

1115
## [9.20.0] - 2022-12-12
1216

packages/generator-widget/generators/app/templates/packages/package_native.json.ejs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
"@mendix/pluggable-widgets-tools": "^9.24.0"<% if (isLanguageTS) { %>,
3131
"@types/big.js": "^6.0.2",<% if (hasUnitTests) { %>
3232
"@types/enzyme": "^3.10.8",
33-
"@types/jest": "^29.0.0",<% } %>
34-
"@types/react": "~18.0.0",
35-
"@types/react-native": "~0.70.0"<% } %>
33+
"@types/jest": "^29.0.0"<% } %>
34+
<% } %>
3635
},
3736
"dependencies": {
3837

packages/generator-widget/generators/app/templates/packages/package_web.json.ejs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@
3030
"devDependencies": {
3131
"@mendix/pluggable-widgets-tools": "^9.24.0"<% if (isLanguageTS) { %>,
3232
"@types/big.js": "^6.0.2",<% if (hasUnitTests || hasE2eTests) { %>
33-
"@types/enzyme": "^3.10.8",
34-
"@types/enzyme-adapter-react-16": "^1.0.6",<% } %><% if (hasE2eTests) { %>
33+
"@types/enzyme": "^3.10.8",<% } %><% if (hasE2eTests) { %>
3534
"@types/jasmine": "^3.6.9",<% } %><% if (hasUnitTests) { %>
36-
"@types/jest": "^29.0.0",<% } %>
37-
"@types/react": "~18.0.0",
38-
"@types/react-dom": "~18.0.0"<% if (hasUnitTests) { %>,
35+
"@types/jest": "^29.0.0"<% } %><% if (hasUnitTests) { %>,
3936
"@types/react-test-renderer": "~18.0.0"<% } %><% } %><% if (hasE2eTests) { %>,
4037
"cypress": "^10.10.0"<% } %>
4138
},

packages/pluggable-widgets-tools/CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ All notable changes to this tool will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
89
### Added
910

1011
- We added support to the typings generator for the data source caption (`{caption: string}`), introduced in version 9.24.0. This feature will give widget developers the ability to display the same caption for a data source, that Mendix uses in the Page Explorer, within a widget preview.
1112

13+
- We've added an option to automatically migrate known libraries to versions compatible with Studio Pro 9.24
14+
15+
- We added `@types/react`, `@types/react-dom` and `@types/react-native` as direct dependencies of the Pluggable Widgets Tools
16+
1217
### Changed
1318

14-
- We've updated our library versions (React and React Native), please be aware this might break your widgets. New libraries versions: React: 18.0.2, React-Native: 0.70.7. This is necessary due to breaking changes introduced in Studio Pro 9.24.0.
15-
- We pinned our version of Typescript to 4.9.5
19+
- We updated the Mendix package to version 9.24.2965.
20+
21+
- We bumped the pinned version of TypeScript to 4.9.5.
22+
1623
- We updated the typings generator for icon properties to support icon collections, introduced in Mendix 9.24.
1724

1825
### Fixed
@@ -27,6 +34,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2734

2835
- Icon properties now use `undefined` instead of `null` when no icon is selected. This change was done for compatibility with the `Icon` component in the pluggable widgets API.
2936

37+
- We've updated our library versions (React and React Native), please be aware this might break your widgets. New libraries versions: React: 18.0.2, React-Native: 0.70.7. This is necessary due to breaking changes introduced in Studio Pro 9.24.0.
38+
3039
## [9.23.2] - 2023-03-07
3140

3241
### Fixed

packages/pluggable-widgets-tools/bin/mx-scripts.js

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,45 @@
22
const { execSync, spawnSync } = require("child_process");
33
const { existsSync } = require("fs");
44
const { delimiter, dirname, join, parse } = require("path");
5+
const { checkMigration } = require("../utils/migration");
6+
const { red } = require("ansi-colors");
57

68
checkNodeVersion();
9+
(async () => {
10+
try {
11+
await checkMigration();
12+
} catch (e) {
13+
console.log(red("An error occurred while checking migration dependencies"));
14+
}
715

8-
const [, currentScriptPath, cmd, ...args] = process.argv;
9-
const toolsRoot = currentScriptPath.endsWith("pluggable-widgets-tools")
10-
? join(dirname(currentScriptPath), "../@mendix/pluggable-widgets-tools")
11-
: join(dirname(currentScriptPath), "..");
16+
const [, currentScriptPath, cmd, ...args] = process.argv;
17+
const toolsRoot = currentScriptPath.endsWith("pluggable-widgets-tools")
18+
? join(dirname(currentScriptPath), "../@mendix/pluggable-widgets-tools")
19+
: join(dirname(currentScriptPath), "..");
1220

13-
if (args.indexOf("--subprojectPath") > -1) {
14-
args.splice(args.indexOf("--subprojectPath"), 2);
15-
}
16-
const realCommand = getRealCommand(cmd, toolsRoot) + " " + args.join(" ");
17-
console.log(`Running MX Widgets Tools script ${cmd}...`);
21+
if (args.indexOf("--subprojectPath") > -1) {
22+
args.splice(args.indexOf("--subprojectPath"), 2);
23+
}
24+
const realCommand = getRealCommand(cmd, toolsRoot) + " " + args.join(" ");
25+
console.log(`Running MX Widgets Tools script ${cmd}...`);
1826

19-
for (const subCommand of realCommand.split(/&&/g)) {
20-
const result = spawnSync(subCommand.trim(), [], {
21-
cwd: process.cwd(),
22-
env: {
23-
...process.env,
24-
PATH: `${process.env.PATH}${delimiter}${findNodeModulesBin()}`,
25-
// Hack for Windows using NTFS Filesystem, we cannot add platform specific check otherwise GitBash or other linux based terminal on windows will also fail.
26-
Path: `${process.env.Path}${delimiter}${findNodeModulesBin()}`
27-
},
28-
shell: true,
29-
stdio: "inherit"
30-
});
31-
if (result.status !== 0) {
32-
process.exit(result.status);
27+
for (const subCommand of realCommand.split(/&&/g)) {
28+
const result = spawnSync(subCommand.trim(), [], {
29+
cwd: process.cwd(),
30+
env: {
31+
...process.env,
32+
PATH: `${process.env.PATH}${delimiter}${findNodeModulesBin()}`,
33+
// Hack for Windows using NTFS Filesystem, we cannot add platform specific check otherwise GitBash or other linux based terminal on windows will also fail.
34+
Path: `${process.env.Path}${delimiter}${findNodeModulesBin()}`
35+
},
36+
shell: true,
37+
stdio: "inherit"
38+
});
39+
if (result.status !== 0) {
40+
process.exit(result.status);
41+
}
3342
}
34-
}
43+
})();
3544

3645
function getRealCommand(cmd, toolsRoot) {
3746
const eslintCommand = "eslint --config .eslintrc.js --ext .jsx,.js,.ts,.tsx src";
@@ -112,19 +121,23 @@ function checkNodeVersion() {
112121
const nodeVersion = extractMajorVersion(execSync("node --version").toString().trim());
113122
const npmVersion = extractMajorVersion(execSync("npm --version").toString().trim());
114123
if (nodeVersion < 16) {
115-
console.error("To build this widget a minimum node version 16.0.0 is required. Please upgrade your node version!");
124+
console.error(
125+
"To build this widget a minimum node version 16.0.0 is required. Please upgrade your node version!"
126+
);
116127
process.exit(1);
117128
}
118129
if (npmVersion < 8) {
119-
console.error("To build this widget a minimum npm version 8.0.0 is required. Please upgrade your npm version!");
130+
console.error(
131+
"To build this widget a minimum npm version 8.0.0 is required. Please upgrade your npm version!"
132+
);
120133
process.exit(1);
121134
}
122-
} catch(e) {
123-
throw new Error("Cannot find node or npm to determine the version")
135+
} catch (e) {
136+
throw new Error("Cannot find node or npm to determine the version");
124137
}
125138
}
126139

127140
function extractMajorVersion(version) {
128-
const majorVersion = version.replace(/^\D+/, '').split(".")[0];
141+
const majorVersion = version.replace(/^\D+/, "").split(".")[0];
129142
return Number(majorVersion);
130143
}

packages/pluggable-widgets-tools/package-lock.json

Lines changed: 34 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/pluggable-widgets-tools/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
},
1717
"files": [
1818
"bin",
19-
"scripts",
2019
"configs",
21-
"test-config",
2220
"dist",
23-
"typings"
21+
"patches",
22+
"scripts",
23+
"test-config",
24+
"typings",
25+
"utils"
2426
],
2527
"dependencies": {
2628
"@babel/core": "^7.12.3",
@@ -42,6 +44,9 @@
4244
"@testing-library/jest-dom": "^5.16.5",
4345
"@testing-library/react": "^13.4.0",
4446
"@testing-library/user-event": "^14.4.3",
47+
"@types/react": "^18.0.0",
48+
"@types/react-dom": "^18.0.0",
49+
"@types/react-native": "^0.70.0",
4550
"@types/testing-library__jest-dom": "^5.14.5",
4651
"@typescript-eslint/eslint-plugin": "^5.8.1",
4752
"@typescript-eslint/parser": "^5.8.1",
@@ -72,7 +77,7 @@
7277
"jest-jasmine2": "^29.0.3",
7378
"jest-junit": "^13.0.0",
7479
"jest-react-hooks-shallow": "^1.5.1",
75-
"mendix": "^9.22.62233",
80+
"mendix": "^9.24.2965",
7681
"metro-react-native-babel-preset": "^0.74.1",
7782
"node-fetch": "^2.6.1",
7883
"postcss": "^8.3.11",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/node_modules/react-native-camera/src/RNCamera.js b/node_modules/react-native-camera/src/RNCamera.js
2+
index 0d9b516..e0eeeec 100644
3+
--- a/node_modules/react-native-camera/src/RNCamera.js
4+
+++ b/node_modules/react-native-camera/src/RNCamera.js
5+
@@ -5,7 +5,6 @@ import {
6+
findNodeHandle,
7+
Platform,
8+
NativeModules,
9+
- ViewPropTypes,
10+
requireNativeComponent,
11+
View,
12+
ActivityIndicator,
13+
@@ -13,6 +12,7 @@ import {
14+
StyleSheet,
15+
PermissionsAndroid,
16+
} from 'react-native';
17+
+import {ViewPropTypes} from 'deprecated-react-native-prop-types';
18+
19+
import type { FaceFeature } from './FaceDetector';
20+

0 commit comments

Comments
 (0)