Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions apps/common-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"@shopify/flash-list": "2.1.0",
"d3-shape": "3.2.0",
"fuse.js": "patch:fuse.js@npm%3A7.1.0#~/.yarn/patches/fuse.js-npm-7.1.0-5dcae892a6.patch",
"react": "19.1.1",
"react-dom": "19.1.1",
"react": "19.2.0",
"react-dom": "19.2.0",
"react-native-gesture-handler": "2.28.0",
"react-native-mmkv": "4.0.0",
"react-native-nitro-modules": "0.31.9",
Expand All @@ -52,10 +52,10 @@
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
"@react-native/babel-preset": "0.82.0",
"@react-native/eslint-config": "0.82.0",
"@react-native/metro-config": "0.82.0",
"@react-native/typescript-config": "0.82.0",
"@react-native/babel-preset": "0.83.0-rc.4",
"@react-native/eslint-config": "0.83.0-rc.4",
"@react-native/metro-config": "0.83.0-rc.4",
"@react-native/typescript-config": "0.83.0-rc.4",
"@tsconfig/react-native": "3.0.0",
"@types/d3-shape": "3.1.7",
"@types/jest": "30.0.0",
Expand All @@ -65,8 +65,8 @@
"jest": "30.2.0",
"madge": "8.0.0",
"prettier": "3.6.2",
"react-native": "0.82.0",
"react-test-renderer": "19.1.1",
"react-native": "0.83.0-rc.4",
"react-test-renderer": "19.2.0",
"typescript": "5.8.3",
"typescript-eslint": "8.46.0"
}
Expand Down
50 changes: 40 additions & 10 deletions apps/common-app/scripts/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,71 @@ const path = require('path');
/**
* @param {Object<string, string>} dependencies
* @param {Set<string>} exclude
* @param {string} appDir
*/
function resolveDependencies(dependencies = {}, exclude) {
function resolveDependencies(dependencies = {}, exclude, appDir) {
return Object.fromEntries(
Object.keys(dependencies)
.filter((name) => !exclude.has(name))
.map((name) => [
name,
{ root: path.resolve(__dirname, `../../../node_modules/${name}`) },
{
root: getRootPath(name, appDir),
},
])
);
}

/**
* @param {string} moduleName
* @param {string} appDir
*/
function getRootPath(moduleName, appDir) {
try {
return path.dirname(
require.resolve(`${moduleName}/package.json`, {
paths: [appDir, __dirname],
})
);
} catch {
// If a package defines an `exports` field, `require.resolve` can fail.
// Fortunately, none of the packages we care about cause this issue.
}
}

/**
* This function will return the dependencies from the common-app package that
* aren't listed in the current app's package.json
*
* @param {string} currentAppDir - The current app directory (e.g. __dirname)
* @param {string[]} exclude - The dependencies to exclude from the common-app
* @param {string} appDir - The directory of the app that wants to obtain the
* dependencies. Used in resolution priority.
* @param {string[]} [exclude=[]] - The dependencies to exclude from the
* common-app. Default is `[]`
*/
function getDependencies(currentAppDir = '.', exclude = []) {
function getDependencies(appDir, exclude = []) {
const commonAppDir = path.resolve(__dirname, '..');
const commonAppPkg = require(path.resolve(commonAppDir, 'package.json'));

const currentAppPkg = require(path.resolve(currentAppDir, 'package.json'));
const appPkg = require(path.resolve(appDir, 'package.json'));

const excludedDependencies = new Set([
...Object.keys(currentAppPkg.devDependencies),
...Object.keys(currentAppPkg.dependencies),
...Object.keys(appPkg.devDependencies),
...Object.keys(appPkg.dependencies),
...exclude,
]);

return {
// Get all common-app dependencies that aren't already in the current app
...resolveDependencies(commonAppPkg.devDependencies, excludedDependencies),
...resolveDependencies(commonAppPkg.dependencies, excludedDependencies),
...resolveDependencies(
commonAppPkg.devDependencies,
excludedDependencies,
appDir
),
...resolveDependencies(
commonAppPkg.dependencies,
excludedDependencies,
appDir
),
};
}

Expand Down
8 changes: 4 additions & 4 deletions apps/fabric-example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ react {
// The root of your project, i.e. where "package.json" lives. Default is '../..'
// root = file("../../")
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
reactNativeDir = file("../../../../node_modules/react-native")
reactNativeDir = file("../../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
codegenDir = file("../../../../node_modules/@react-native/codegen")
codegenDir = file("../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
cliFile = file("../../../../node_modules/react-native/cli.js")
cliFile = file("../../node_modules/react-native/cli.js")

/* Variants */
// The list of variants to that are debuggable. For those we're going to
Expand Down Expand Up @@ -45,7 +45,7 @@ react {

/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
hermesCommand = "../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
hermesCommand = "./node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
);
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DFOLLY_NO_CONFIG",
Expand All @@ -463,7 +464,7 @@
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
USE_HERMES = true;
Expand Down Expand Up @@ -538,6 +539,7 @@
"\"$(inherited)\"",
);
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DFOLLY_NO_CONFIG",
Expand All @@ -550,7 +552,7 @@
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
VALIDATE_PRODUCT = YES;
Expand Down
Loading
Loading