Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit dd09f19

Browse files
committed
🔧 (multi-projects) Adapt project to use root project dependencies
1 parent d0c81f2 commit dd09f19

7 files changed

Lines changed: 105 additions & 2113 deletions

File tree

example/babel.config.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
module.exports = {
2-
presets: ["module:metro-react-native-babel-preset"],
3-
plugins: [
4-
[
5-
"module-resolver",
6-
{
7-
root: ["./src"]
8-
}
9-
]
10-
]
2+
presets: ['module:metro-react-native-babel-preset', '@babel/preset-typescript'],
113
};

example/jest.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2-
preset: "react-native",
3-
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
2+
preset: 'react-native',
3+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
4+
moduleDirectories: ['node_modules', '<rootDir>/../node_modules'],
45
};

example/metro.config.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,30 @@
55
* @format
66
*/
77

8+
const path = require('path');
9+
810
module.exports = {
11+
projectRoot: path.resolve(__dirname),
12+
watchFolders: [path.resolve(__dirname, '../src'), path.resolve(__dirname, '../node_modules')],
13+
resolver: {
14+
extraNodeModules: {
15+
'react-gondola': path.resolve(__dirname, '../src'),
16+
// Important, those are all the dependencies
17+
// asked by the "../src" but which
18+
// are not present in the ROOT/node_modules
19+
// See https://github.com/facebook/metro/issues/7#issuecomment-464668678.
20+
mobx: path.resolve(__dirname, '../node_modules/mobx'),
21+
'mobx-react': path.resolve(__dirname, '../node_modules/mobx-react'),
22+
react: path.resolve(__dirname, '../node_modules/react'),
23+
'react-native': path.resolve(__dirname, '../node_modules/react-native'),
24+
},
25+
},
926
transformer: {
1027
getTransformOptions: async () => ({
1128
transform: {
1229
experimentalImportSupport: false,
13-
inlineRequires: false
14-
}
15-
})
16-
}
30+
inlineRequires: false,
31+
},
32+
}),
33+
},
1734
};

example/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,17 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"start": "node node_modules/react-native/local-cli/cli.js start",
6+
"start": "node ../node_modules/react-native/local-cli/cli.js start",
77
"test:lint": "cd .. && yarn tslint example/src/**/*.ts{,x} && cd example",
88
"test:unit": "jest",
99
"test:unit:ci": "jest --runInBand",
1010
"test:type": "tsc --noEmit",
1111
"test": "yarn test:lint && yarn test:unit && yarn test:type",
1212
"test:ci": "yarn test:lint && yarn test:unit:ci && yarn test:type"
1313
},
14-
"dependencies": {
15-
"mobx": "^5.9.4",
16-
"mobx-react": "^5.4.3",
17-
"react": "16.8.3",
18-
"react-native": "0.59.5",
19-
"react-gondola": "file:../src"
20-
},
2114
"devDependencies": {
2215
"@babel/core": "^7.4.3",
16+
"@babel/preset-typescript": "^7.3.3",
2317
"@babel/runtime": "^7.4.3",
2418
"@types/jest": "^24.0.11",
2519
"@types/react-native": "^0.57.45",

example/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
"isolatedModules": true,
2929
"moduleResolution": "node",
3030
"paths": {
31-
"react-gondola": ["../../src"]
31+
"react-gondola": ["../../src"],
32+
"mobx": ["../node_modules/mobx"],
33+
"mobx-react": ["../node_modules/mobx-react"],
34+
"react": ["../node_modules/react"],
35+
"react-native": ["../node_modules/react-native"]
3236
}
3337
},
3438
"include": ["./src"],

0 commit comments

Comments
 (0)