Skip to content

Commit 37d5b08

Browse files
committed
feat: remove the patch-package script as it is no longer needed for PNPM
1 parent 6671299 commit 37d5b08

12 files changed

Lines changed: 269 additions & 280 deletions

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "Apache-2.0",
1010
"scripts": {
1111
"prepare": "npx husky install && pnpm -r run prepare",
12-
"postinstall": "patch-package && pnpm -r run postinstall",
12+
"postinstall": "pnpm -r run postinstall",
1313
"reinstall": "pnpm store prune && git clean -dfx && find . -type dir -name node_modules | xargs rm -rf && pnpm install && pnpm run postinstall",
1414
"prettier": "prettier --config \"./prettier.config.js\" --write \"**/*.{js,jsx,ts,tsx,scss,html,xml,yml,yaml}\"",
1515
"format": "pretty-quick --staged --config \"./prettier.config.js\" --pattern \"**/{src,script,typings,test,**}/**/*.{js,jsx,ts,tsx,scss,html,xml,md,json}\"",
@@ -29,7 +29,6 @@
2929
"version": "ts-node --project ./scripts/tsconfig.json ./scripts/release/BumpVersion.ts",
3030
"validate-staged-widget-versions": "node scripts/validation/validate-versions-staged-files.js",
3131
"setup-mobile": "pnpm setup-android && pnpm setup-ios",
32-
"patch-package": "sh ./scripts/patch/patch-package.sh",
3332
"build:widgets": "node ./scripts/widget/buildWidgets.js",
3433
"test_widgets:maestro:ios": "bash maestro/run_maestro_widget_tests.sh ios",
3534
"test_widgets:maestro:android": "bash maestro/run_maestro_widget_tests.sh android",
@@ -65,7 +64,6 @@
6564
"image-js": "^0.35.6",
6665
"lint-staged": "^10.5.4",
6766
"mendix-client": "^7.15.8",
68-
"patch-package": "^8.0.0",
6967
"pixelmatch": "^5.3.0",
7068
"pngjs": "^6.0.0",
7169
"pretty-quick": "^3.3.1",
@@ -94,6 +92,15 @@
9492
"@types/react-native": "0.73.0",
9593
"cheerio": "1.0.0-rc.12",
9694
"typescript": "~5.8.0"
95+
},
96+
"patchedDependencies": {
97+
"@mendix/pluggable-widgets-tools@10.21.1": "patches/@mendix+pluggable-widgets-tools+10.21.1.patch",
98+
"@ptomasroos/react-native-multi-slider@1.0.0": "patches/@ptomasroos+react-native-multi-slider+1.0.0.patch",
99+
"react-native-action-button@2.8.5": "patches/react-native-action-button+2.8.5.patch",
100+
"react-native-camera@3.40.0": "patches/react-native-camera+3.40.0.patch",
101+
"react-native-gesture-handler@2.24.0": "patches/react-native-gesture-handler+2.24.0.patch",
102+
"react-native-slider@0.11.0": "patches/react-native-slider+0.11.0.patch",
103+
"react-native-snap-carousel@3.9.1": "patches/react-native-snap-carousel+3.9.1.patch"
97104
}
98105
},
99106
"packageManager": "pnpm@10.13.1"

patches/@mendix+pluggable-widgets-tools+10.21.1+001+core.patch

Lines changed: 0 additions & 22 deletions
This file was deleted.

patches/@mendix+pluggable-widgets-tools+10.21.1+002+rollup-file-copy.patch

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
diff --git a/bin/mx-scripts.js b/bin/mx-scripts.js
2+
index 673e0b2ebc148755e575cc77c3fc493ba7b5cfde..055f87d9644b2e3d2e3bd74bf416a593234447b3 100755
3+
--- a/bin/mx-scripts.js
4+
+++ b/bin/mx-scripts.js
5+
@@ -107,7 +107,7 @@ function getRealCommand(cmd, toolsRoot) {
6+
}
7+
8+
function findNodeModulesBin() {
9+
- let parentDir = join(__dirname, "..");
10+
+ let parentDir = join(__dirname, "../..");
11+
const bins = [];
12+
while (parse(parentDir).root !== parentDir) {
13+
const candidate = join(parentDir, "node_modules/.bin");
14+
diff --git a/configs/rollup-plugin-collect-dependencies.mjs b/configs/rollup-plugin-collect-dependencies.mjs
15+
index 2d0b5bfac7f1a1482bc1a222cba3e52b0339cc79..a3f0e368d76d294a5f7cd85886fe5ce0e72b9619 100644
16+
--- a/configs/rollup-plugin-collect-dependencies.mjs
17+
+++ b/configs/rollup-plugin-collect-dependencies.mjs
18+
@@ -2,9 +2,8 @@
19+
20+
import fg from "fast-glob";
21+
import fsExtra from "fs-extra";
22+
-import { existsSync, readFileSync, writeFileSync } from "fs";
23+
+import { existsSync, readFileSync, writeFileSync, cpSync, lstatSync, realpathSync } from "fs";
24+
import { dirname, join, parse } from "path";
25+
-import copy from "recursive-copy";
26+
import { promisify } from "util";
27+
import resolve from "resolve";
28+
import _ from "lodash";
29+
@@ -171,15 +170,41 @@ async function copyJsModule(moduleSourcePath, to) {
30+
if (existsSync(to)) {
31+
return;
32+
}
33+
- return promisify(copy)(moduleSourcePath, to, {
34+
- filter: [
35+
- "**/*.*",
36+
- LICENSE_GLOB,
37+
- "!**/{android,ios,windows,mac,jest,github,gradle,__*__,docs,jest,example*}/**/*",
38+
- "!**/*.{config,setup}.*",
39+
- "!**/*.{podspec,flow}"
40+
- ]
41+
- });
42+
+
43+
+ try {
44+
+ // Check if the source is a symlink and resolve it to the actual path
45+
+ let actualSourcePath = moduleSourcePath;
46+
+ if (lstatSync(moduleSourcePath).isSymbolicLink()) {
47+
+ actualSourcePath = realpathSync(moduleSourcePath);
48+
+ }
49+
+
50+
+ cpSync(actualSourcePath, to, {
51+
+ recursive: true,
52+
+ dereference: true, // Follow symlinks and copy the actual files
53+
+ filter: (src, dest) => {
54+
+ const relativePath = src.replace(actualSourcePath, '').replace(/^[\\/]/, '');
55+
+
56+
+ // Skip certain directories
57+
+ if (relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)) {
58+
+ return false;
59+
+ }
60+
+
61+
+ // Skip certain file types
62+
+ if (relativePath.match(/\.(config|setup)\.|\.podspec$|\.flow$/)) {
63+
+ return false;
64+
+ }
65+
+
66+
+ // Include LICENSE files
67+
+ if (relativePath.match(/license/i)) {
68+
+ return true;
69+
+ }
70+
+
71+
+ return true;
72+
+ }
73+
+ });
74+
+ } catch (error) {
75+
+ throw error;
76+
+ }
77+
}
78+
79+
function getModuleName(modulePath) {
80+
diff --git a/test-config/jest.native.config.js b/test-config/jest.native.config.js
81+
index 72e3c51473b7566ca9d8b224b35334099ce615db..7e0949aa5d50d288d848117a804fd691422aefde 100644
82+
--- a/test-config/jest.native.config.js
83+
+++ b/test-config/jest.native.config.js
84+
@@ -3,7 +3,7 @@ const { join } = require("path");
85+
const projectDir = process.cwd();
86+
87+
module.exports = {
88+
- preset: hasDependency("@testing-library/react-native") ? "@testing-library/react-native" : "react-native",
89+
+ preset: "react-native",
90+
testRunner: "jest-jasmine2",
91+
clearMocks: true,
92+
haste: {
93+
@@ -14,9 +14,7 @@ module.exports = {
94+
setupFilesAfterEnv: [
95+
join(__dirname, "test-index-native.js"),
96+
...(hasDependency("react-native-gesture-handler") ? ["react-native-gesture-handler/jestSetup.js"] : []),
97+
- ...(hasDependency("@testing-library/jest-native") ? ["@testing-library/jest-native/extend-expect"] : [])
98+
],
99+
- snapshotSerializers: ["enzyme-to-json/serializer"],
100+
testMatch: ["<rootDir>/**/*.spec.{js,jsx,ts,tsx}"],
101+
transformIgnorePatterns: ["node_modules/(?!(.*react-native.*|victory-)/)"],
102+
transform: {
103+
@@ -35,7 +33,6 @@ module.exports = {
104+
"react-hot-loader/root": join(__dirname, "__mocks__/hot")
105+
},
106+
moduleDirectories: ["node_modules", join(projectDir, "node_modules")],
107+
- collectCoverage: !process.env.CI,
108+
coverageDirectory: join(projectDir, "dist/coverage"),
109+
testEnvironment: "jsdom"
110+
};
111+
diff --git a/test-config/test-index-native.js b/test-config/test-index-native.js
112+
index 8c4d3dd8475ec4ecceb3f36d74edbe9b7313599e..eec5172291384fc5606736b59c4aa7d4f75f9d34 100644
113+
--- a/test-config/test-index-native.js
114+
+++ b/test-config/test-index-native.js
115+
@@ -1,6 +1,4 @@
116+
const { TextEncoder, TextDecoder } = require("util");
117+
-const { configure: configureEnzyme } = require("enzyme");
118+
-const Adapter = require("@cfaester/enzyme-adapter-react-18").default;
119+
const enableHooks = require("jest-react-hooks-shallow").default;
120+
121+
Object.defineProperties(global, {
122+
@@ -12,7 +10,6 @@ Object.defineProperties(global, {
123+
}
124+
});
125+
126+
-configureEnzyme({ adapter: new Adapter() });
127+
enableHooks(jest);
128+
global.setImmediate = global.setTimeout;
129+
130+
diff --git a/test-config/transform-native.js b/test-config/transform-native.js
131+
index eed8109dada3788bb1195573b9713eb1f00dd8f9..4b422fac0e21d2b1f44a763d0b21b0280bf1cacb 100644
132+
--- a/test-config/transform-native.js
133+
+++ b/test-config/transform-native.js
134+
@@ -1,3 +1,3 @@
135+
module.exports = require("babel-jest").createTransformer({
136+
- presets: ["module:metro-react-native-babel-preset"]
137+
+ presets: ["module:@react-native/babel-preset"]
138+
});

patches/@ptomasroos+react-native-multi-slider+1.0.0.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/node_modules/@ptomasroos/react-native-multi-slider/DefaultMarker.js b/node_modules/@ptomasroos/react-native-multi-slider/DefaultMarker.js
1+
diff --git a/DefaultMarker.js b/DefaultMarker.js
22
index 618d916..bb30f07 100644
3-
--- a/node_modules/@ptomasroos/react-native-multi-slider/DefaultMarker.js
4-
+++ b/node_modules/@ptomasroos/react-native-multi-slider/DefaultMarker.js
3+
--- a/DefaultMarker.js
4+
+++ b/DefaultMarker.js
55
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
66

77
import { View, StyleSheet, Platform, TouchableHighlight } from 'react-native';
@@ -11,10 +11,10 @@ index 618d916..bb30f07 100644
1111

1212
export default class DefaultMarker extends React.Component {
1313
static propTypes = {
14-
diff --git a/node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js b/node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js
14+
diff --git a/MultiSlider.js b/MultiSlider.js
1515
index 3a5e417..e48b97b 100755
16-
--- a/node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js
17-
+++ b/node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js
16+
--- a/MultiSlider.js
17+
+++ b/MultiSlider.js
1818
@@ -12,8 +12,7 @@ import {
1919

2020
import DefaultMarker from './DefaultMarker';

patches/react-native-action-button+2.8.5.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/node_modules/react-native-action-button/ActionButton.js b/node_modules/react-native-action-button/ActionButton.js
1+
diff --git a/ActionButton.js b/ActionButton.js
22
index b8306c2efb2460d4aa110e83d2e5410588f280de..890003d30fa5400f4778f5bb2dffa10e70fbe3ee 100644
3-
--- a/node_modules/react-native-action-button/ActionButton.js
4-
+++ b/node_modules/react-native-action-button/ActionButton.js
3+
--- a/ActionButton.js
4+
+++ b/ActionButton.js
55
@@ -16,6 +16,7 @@ import {
66
touchableBackground,
77
DEFAULT_ACTIVE_OPACITY

patches/react-native-camera+3.40.0.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/node_modules/react-native-camera/src/RNCamera.js b/node_modules/react-native-camera/src/RNCamera.js
1+
diff --git a/src/RNCamera.js b/src/RNCamera.js
22
index 0d9b516..e0eeeec 100644
3-
--- a/node_modules/react-native-camera/src/RNCamera.js
4-
+++ b/node_modules/react-native-camera/src/RNCamera.js
3+
--- a/src/RNCamera.js
4+
+++ b/src/RNCamera.js
55
@@ -5,7 +5,6 @@ import {
66
findNodeHandle,
77
Platform,

patches/react-native-gesture-handler+2.24.0.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/node_modules/react-native-gesture-handler/lib/typescript/components/Swipeable.d.ts b/node_modules/react-native-gesture-handler/lib/typescript/components/Swipeable.d.ts
1+
diff --git a/lib/typescript/components/Swipeable.d.ts b/lib/typescript/components/Swipeable.d.ts
22
index 0cbe84f..ed2a5a6 100644
3-
--- a/node_modules/react-native-gesture-handler/lib/typescript/components/Swipeable.d.ts
4-
+++ b/node_modules/react-native-gesture-handler/lib/typescript/components/Swipeable.d.ts
3+
--- a/lib/typescript/components/Swipeable.d.ts
4+
+++ b/lib/typescript/components/Swipeable.d.ts
55
@@ -1,5 +1,5 @@
66
import * as React from 'react';
77
-import { Component } from 'react';

patches/react-native-slider+0.11.0.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
diff --git a/node_modules/react-native-slider/lib/Slider.js b/node_modules/react-native-slider/lib/Slider.js
1+
diff --git a/lib/Slider.js b/lib/Slider.js
22
index c640410..5b56a09 100644
3-
--- a/node_modules/react-native-slider/lib/Slider.js
4-
+++ b/node_modules/react-native-slider/lib/Slider.js
3+
--- a/lib/Slider.js
4+
+++ b/lib/Slider.js
55
@@ -5,6 +5,7 @@ var _react=require("react");var _react2=_interopRequireDefault(_react);
66

77

@@ -28,10 +28,10 @@ index c640410..5b56a09 100644
2828
* Set this to true to visually see the thumb touch rect in green.
2929
*/debugTouchArea:_propTypes2.default.bool, /**
3030
* Set to true to animate values with default 'timing' animation type
31-
diff --git a/node_modules/react-native-slider/src/Slider.js b/node_modules/react-native-slider/src/Slider.js
31+
diff --git a/src/Slider.js b/src/Slider.js
3232
index 37deee5..b8a21a3 100644
33-
--- a/node_modules/react-native-slider/src/Slider.js
34-
+++ b/node_modules/react-native-slider/src/Slider.js
33+
--- a/src/Slider.js
34+
+++ b/src/Slider.js
3535
@@ -11,9 +11,10 @@ import {
3636
PanResponder,
3737
View,

0 commit comments

Comments
 (0)