Skip to content

Commit 9d526ea

Browse files
author
Harun.Karahan
committed
chore: fix build process
1 parent 52e5479 commit 9d526ea

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

configs/jsactions/rollup-plugin-collect-dependencies.mjs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
import fg from "fast-glob";
44
import fsExtra from "fs-extra";
5-
import { existsSync, readFileSync, writeFileSync } from "fs";
5+
import { existsSync, readFileSync, writeFileSync, cpSync, lstatSync, realpathSync } from "fs";
66
import { dirname, join, parse } from "path";
7-
import copy from "recursive-copy";
87
import { promisify } from "util";
98
import resolve from "resolve";
109
import _ from "lodash";
@@ -172,15 +171,36 @@ export async function copyJsModule(moduleSourcePath, to) {
172171
if (existsSync(to)) {
173172
return;
174173
}
175-
return promisify(copy)(moduleSourcePath, to, {
176-
filter: [
177-
"**/*.*",
178-
LICENSE_GLOB,
179-
"!**/{android,ios,windows,mac,jest,github,gradle,__*__,docs,jest,example*}/**/*",
180-
"!**/*.{config,setup}.*",
181-
"!**/*.{podspec,flow}"
182-
],
183-
overwrite: true
174+
175+
// Check if the source is a symlink and resolve it to the actual path
176+
let actualSourcePath = moduleSourcePath;
177+
if (lstatSync(moduleSourcePath).isSymbolicLink()) {
178+
actualSourcePath = realpathSync(moduleSourcePath);
179+
}
180+
181+
cpSync(actualSourcePath, to, {
182+
recursive: true,
183+
dereference: true, // Follow symlinks and copy the actual files
184+
filter: (src, dest) => {
185+
const relativePath = src.replace(actualSourcePath, "").replace(/^[\\/]/, "");
186+
187+
// Skip certain directories
188+
if (relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)) {
189+
return false;
190+
}
191+
192+
// Skip certain file types
193+
if (relativePath.match(/\.(config|setup)\.|\.podspec$|\.flow$/)) {
194+
return false;
195+
}
196+
197+
// Include LICENSE files
198+
if (relativePath.match(/license/i)) {
199+
return true;
200+
}
201+
202+
return true;
203+
}
184204
});
185205
}
186206

0 commit comments

Comments
 (0)