Skip to content

Commit ebe4512

Browse files
committed
refactor: use react-native-monorepo-config in the example
1 parent 0f6f749 commit ebe4512

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

packages/create-react-native-library/src/exampleApp/generateExampleApp.ts

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export default async function generateExampleApp({
192192

193193
const PACKAGES_TO_ADD_DEV = {
194194
'react-native-builder-bob': `^${config.versions.bob}`,
195+
'react-native-monorepo-config': `^0.1.9`,
195196
};
196197

197198
if (config.project.moduleConfig === 'nitro-modules') {
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const { getDefaultConfig } = require('@react-native/metro-config');
3-
const { getConfig } = require('react-native-builder-bob/metro-config');
3+
const { withMetroConfig } = require('react-native-monorepo-config');
44

55
const root = path.resolve(__dirname, '..');
66

@@ -10,7 +10,7 @@ const root = path.resolve(__dirname, '..');
1010
*
1111
* @type {import('metro-config').MetroConfig}
1212
*/
13-
module.exports = getConfig(getDefaultConfig(__dirname), {
13+
module.exports = withMetroConfig(getDefaultConfig(__dirname), {
1414
root,
15-
project: __dirname,
15+
dirname: __dirname,
1616
});
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const { getDefaultConfig } = require('@expo/metro-config');
3-
const { getConfig } = require('react-native-builder-bob/metro-config');
3+
const { withMetroConfig } = require('react-native-monorepo-config');
44

55
const root = path.resolve(__dirname, '..');
66

@@ -10,7 +10,7 @@ const root = path.resolve(__dirname, '..');
1010
*
1111
* @type {import('metro-config').MetroConfig}
1212
*/
13-
module.exports = getConfig(getDefaultConfig(__dirname), {
13+
module.exports = withMetroConfig(getDefaultConfig(__dirname), {
1414
root,
15-
project: __dirname,
15+
dirname: __dirname,
1616
});

packages/react-native-builder-bob/metro-config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/no-require-imports, import-x/no-commonjs, no-undef */
1+
/* eslint-disable @typescript-eslint/no-deprecated, @typescript-eslint/no-require-imports, import-x/no-commonjs, no-undef */
22

33
const { withMetroConfig } = require('react-native-monorepo-config');
44

@@ -7,6 +7,8 @@ const { withMetroConfig } = require('react-native-monorepo-config');
77
* This sets up appropriate root and watch folders for the library.
88
* It also excludes conflicting modules and aliases them to the correct place.
99
*
10+
* @deprecated use `react-native-monorepo-config` instead
11+
*
1012
* @param {import('metro-config').MetroConfig} baseConfig Base Metro configuration
1113
* @param {object} options Options to customize the configuration
1214
* @param {string} options.root Root directory of the monorepo

0 commit comments

Comments
 (0)