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

Commit b84141a

Browse files
authored
Merge pull request #23 from tpucci/canal
Init canal
2 parents f5fc34d + 35db677 commit b84141a

15 files changed

Lines changed: 240 additions & 5517 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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
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', 'example/node_modules'],
5+
rootDir: '..',
6+
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/src/'],
47
};

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: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,21 @@
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",
8-
"test:unit": "jest",
9-
"test:unit:ci": "jest --runInBand",
8+
"test:unit": "cd .. && yarn jest --config=example/jest.config.js && cd example",
9+
"test:unit:ci": "cd .. && yarn jest --config=example/jest.config.js --runInBand && cd example",
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",
24-
"@types/jest": "^24.0.11",
2518
"@types/react-native": "^0.57.45",
26-
"@types/react-test-renderer": "^16.8.1",
27-
"babel-jest": "^24.7.1",
2819
"babel-plugin-module-resolver": "^3.2.0",
29-
"jest": "^24.7.1",
3020
"metro-react-native-babel-preset": "^0.53.1",
31-
"react-test-renderer": "16.8.6",
3221
"typescript": "^3.4.3"
3322
}
3423
}

example/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { Component } from 'react';
2-
import { View } from 'react-native';
32
import { NavigationProvider } from 'react-gondola';
3+
import { SignIn } from './canals/SignIn';
44

55
interface IProps {}
66
export default class App extends Component<IProps> {
77
render() {
88
return (
99
<NavigationProvider>
10-
<View />
10+
<SignIn />
1111
</NavigationProvider>
1212
);
1313
}

example/src/canals/SignIn/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { canal } from 'react-gondola';
12
import { FirstName } from './FirstName';
23
import { LastName } from './LastName';
34

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)