Skip to content

Commit a31ae13

Browse files
committed
chore: fix copying symlinks
1 parent a41f437 commit a31ae13

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
diff --git a/node_modules/@mendix/pluggable-widgets-tools/configs/rollup-plugin-collect-dependencies.mjs b/node_modules/@mendix/pluggable-widgets-toolsconfigs/rollup-plugin-collect-dependencies.mjs
2-
index 2d0b5bfac7f1a1482bc1a222cba3e52b0339cc79..44ab7f4aa30abc0ba52672ea3e717f4401d00ed5 100644
1+
diff --git a/node_modules/@mendix/pluggable-widgets-tools/configs/rollup-plugin-collect-dependencies.mjs b/node_modules/@mendix/pluggable-widgets-tools/configs/rollup-plugin-collect-dependencies.mjs
2+
index 2d0b5bfac7f1a1482bc1a222cba3e52b0339cc79..a3f0e368d76d294a5f7cd85886fe5ce0e72b9619 100644
33
--- a/node_modules/@mendix/pluggable-widgets-tools/configs/rollup-plugin-collect-dependencies.mjs
44
+++ b/node_modules/@mendix/pluggable-widgets-tools/configs/rollup-plugin-collect-dependencies.mjs
55
@@ -2,9 +2,8 @@
66

77
import fg from "fast-glob";
88
import fsExtra from "fs-extra";
99
-import { existsSync, readFileSync, writeFileSync } from "fs";
10-
+import { existsSync, readFileSync, writeFileSync, cpSync } from "fs";
10+
+import { existsSync, readFileSync, writeFileSync, cpSync, lstatSync, realpathSync } from "fs";
1111
import { dirname, join, parse } from "path";
1212
-import copy from "recursive-copy";
1313
import { promisify } from "util";
1414
import resolve from "resolve";
1515
import _ from "lodash";
16-
@@ -171,15 +174,34 @@ async function copyJsModule(moduleSourcePath, to) {
16+
@@ -171,15 +170,41 @@ async function copyJsModule(moduleSourcePath, to) {
1717
if (existsSync(to)) {
1818
return;
1919
}
@@ -28,10 +28,17 @@ index 2d0b5bfac7f1a1482bc1a222cba3e52b0339cc79..44ab7f4aa30abc0ba52672ea3e717f44
2828
- });
2929
+
3030
+ try {
31-
+ cpSync(moduleSourcePath, to, {
31+
+ // Check if the source is a symlink and resolve it to the actual path
32+
+ let actualSourcePath = moduleSourcePath;
33+
+ if (lstatSync(moduleSourcePath).isSymbolicLink()) {
34+
+ actualSourcePath = realpathSync(moduleSourcePath);
35+
+ }
36+
+
37+
+ cpSync(actualSourcePath, to, {
3238
+ recursive: true,
39+
+ dereference: true, // Follow symlinks and copy the actual files
3340
+ filter: (src, dest) => {
34-
+ const relativePath = src.replace(moduleSourcePath, '').replace(/^[\\/]/, '');
41+
+ const relativePath = src.replace(actualSourcePath, '').replace(/^[\\/]/, '');
3542
+
3643
+ // Skip certain directories
3744
+ if (relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)) {

0 commit comments

Comments
 (0)