|
| 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 | + }); |
0 commit comments