Skip to content

Commit 3ada328

Browse files
Fix flow, add gh actions ci
1 parent 2d72f16 commit 3ada328

File tree

10 files changed

+102
-74
lines changed

10 files changed

+102
-74
lines changed

.circleci/config.yml

-33
This file was deleted.

.flowconfig

+8-31
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
; Ignore "BUCK" generated dirs
66
<PROJECT_ROOT>/\.buckd/
77

8-
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/.*/node_modules/fbjs/.*
10-
11-
; Ignore duplicate module providers
12-
; For RN Apps installed via npm, "Libraries" folder is inside
13-
; "node_modules/react-native" but in the source repo it is in the root
14-
node_modules/react-native/Libraries/react-native/React.js
15-
168
; Ignore polyfills
179
node_modules/react-native/Libraries/polyfills/.*
1810

@@ -21,15 +13,17 @@ node_modules/react-native/Libraries/polyfills/.*
2113
node_modules/warning/.*
2214

2315
; Flow doesn't support platforms
24-
.*/Libraries/Utilities/HMRLoadingView.js
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
<PROJECT_ROOT>/lib/.*
2519

2620
[untyped]
2721
.*/node_modules/@react-native-community/cli/.*/.*
2822

2923
[include]
3024

3125
[libs]
32-
node_modules/react-native/Libraries/react-native/react-native-interface.js
26+
node_modules/react-native/interface.js
3327
node_modules/react-native/flow/
3428

3529
[options]
@@ -42,27 +36,11 @@ module.file_ext=.js
4236
module.file_ext=.json
4337
module.file_ext=.ios.js
4438

45-
module.system=haste
46-
module.system.haste.use_name_reducers=true
47-
# get basename
48-
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49-
# strip .js or .js.flow suffix
50-
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51-
# strip .ios suffix
52-
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53-
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54-
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55-
module.system.haste.paths.blacklist=.*/__tests__/.*
56-
module.system.haste.paths.blacklist=.*/__mocks__/.*
57-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
58-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
59-
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
60-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61-
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62-
6339
munge_underscores=true
6440

65-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
41+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
42+
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
43+
module.name_mapper='^react-native-fbsdk$' -> '<PROJECT_ROOT>/src'
6644

6745
suppress_type=$FlowIssue
6846
suppress_type=$FlowFixMe
@@ -81,7 +59,6 @@ untyped-type-import=warn
8159
nonstrict-import=warn
8260
deprecated-type=warn
8361
unsafe-getters-setters=warn
84-
inexact-spread=warn
8562
unnecessary-invariant=warn
8663
signature-verification-failure=warn
8764
deprecated-utility=error
@@ -96,4 +73,4 @@ untyped-import
9673
untyped-type-import
9774

9875
[version]
99-
^0.98.0
76+
^0.122.0

.github/workflows/ci.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
js-tests:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- name: Use Node.js 12.x
11+
uses: actions/setup-node@v1
12+
with:
13+
node-version: 12.x
14+
- name: Install yarn
15+
run: npm install -g yarn
16+
- name: Get yarn cache
17+
id: yarn-cache
18+
run: echo "::set-output name=dir::$(yarn cache dir)"
19+
- uses: actions/cache@v1
20+
with:
21+
path: ${{ steps.yarn-cache.outputs.dir }}
22+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-yarn-
25+
- name: Install dependencies
26+
run: yarn install
27+
- name: Run tests
28+
run: yarn test
29+
android-build:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v1
33+
- name: Use Node.js 12.x
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: 12.x
37+
- name: Install yarn
38+
run: npm install -g yarn
39+
- name: Get yarn cache
40+
id: yarn-cache
41+
run: echo "::set-output name=dir::$(yarn cache dir)"
42+
- uses: actions/cache@v1
43+
with:
44+
path: ${{ steps.yarn-cache.outputs.dir }}
45+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-yarn-
48+
- name: Install dependencies
49+
run: yarn install
50+
- name: Build android example app
51+
run: cd example/android && ./gradlew assembleDebug
52+
ios-build:
53+
runs-on: macOS-latest
54+
steps:
55+
- uses: actions/checkout@v1
56+
- name: Use Node.js 12.x
57+
uses: actions/setup-node@v1
58+
with:
59+
node-version: 12.x
60+
- uses: actions/setup-ruby@v1
61+
with:
62+
ruby-version: '2.x'
63+
- name: Install cocoapods
64+
run: gem install cocoapods
65+
- name: Install yarn
66+
run: npm install -g yarn
67+
- name: Get yarn cache
68+
id: yarn-cache
69+
run: echo "::set-output name=dir::$(yarn cache dir)"
70+
- uses: actions/cache@v1
71+
with:
72+
path: ${{ steps.yarn-cache.outputs.dir }}
73+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
74+
restore-keys: |
75+
${{ runner.os }}-yarn-
76+
- name: Install dependencies
77+
run: yarn install
78+
- name: Install pods
79+
run: cd example/ios && pod install
80+
- name: Build ios example app
81+
run: cd example/ios && xcodebuild -scheme RNFBSDKExample -workspace RNFBSDKExample.xcworkspace ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug

example/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
import {AppRegistry} from 'react-native';
6-
import App from './App';
6+
import App from './src/App';
77
import {name as appName} from './app.json';
88

99
AppRegistry.registerComponent(appName, () => App);

example/App.js example/src/App.js

File renamed without changes.

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
"prepare": "bob build",
4444
"flow": "flow",
4545
"lint": "eslint ./src",
46-
"prettier": "prettier \"./src/**/*.js\" --write",
46+
"test": "yarn validate:prettier && yarn validate:eslint && yarn validate:flow",
47+
"validate:eslint": "eslint \"src/**/*\" \"example/src/**/*\"",
48+
"validate:flow": "flow",
49+
"validate:prettier": "prettier \"src/**/*.js\" \"example/src/**/*.js\" --check",
4750
"example:ios": "cd ./example && react-native run-ios",
4851
"example:android": "cd ./example && react-native run-android --no-jetifier"
4952
},
@@ -70,7 +73,7 @@
7073
"babel-plugin-module-resolver": "^4.0.0",
7174
"babel-jest": "^26.0.1",
7275
"eslint": "7.0.0",
73-
"flow-bin": "^0.125.0",
76+
"flow-bin": "^0.122.0",
7477
"jest": "^26.0.1",
7578
"metro-react-native-babel-preset": "^0.59.0",
7679
"prettier": "^2.0.5",

src/FBLoginButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ LoginButton.defaultProps = {
121121
style: styles.defaultButtonStyle,
122122
};
123123

124-
const RCTFBLoginButton = requireNativeComponent('RCTFBLoginButton');
124+
const RCTFBLoginButton = requireNativeComponent<any>('RCTFBLoginButton');
125125

126126
module.exports = LoginButton;

src/FBSendButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ SendButton.defaultProps = {
5858
style: styles.defaultButtonStyle,
5959
};
6060

61-
const RCTFBSendButton = requireNativeComponent('RCTFBSendButton');
61+
const RCTFBSendButton = requireNativeComponent<any>('RCTFBSendButton');
6262

6363
module.exports = SendButton;

src/FBShareButton.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ ShareButton.defaultProps = {
5959
style: styles.defaultButtonStyle,
6060
};
6161

62-
const RCTFBShareButton = requireNativeComponent('RCTFBShareButton');
62+
const RCTFBShareButton = requireNativeComponent<any>('RCTFBShareButton');
6363

6464
module.exports = ShareButton;

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -4297,10 +4297,10 @@ flatted@^2.0.0:
42974297
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
42984298
integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
42994299

4300-
flow-bin@^0.125.0:
4301-
version "0.125.0"
4302-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.125.0.tgz#944239e0c8b76fc63ed6262f7a7fa89db0076502"
4303-
integrity sha512-m9mPCJgH7DNlhEjIkXNxm1p2MMMU+TnLT5SRN17qFpLG+1ddYciNSrAnOlzVOIQgIab4FCzJRr+v+lPjvWNmog==
4300+
flow-bin@^0.122.0:
4301+
version "0.122.0"
4302+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.122.0.tgz#c723a2b33b1a70bd10204704ae1dc776d5d89d79"
4303+
integrity sha512-my8N5jgl/A+UVby9E7NDppHdhLgRbWgKbmFZSx2MSYMRh3d9YGnM2MM+wexpUpl0ftY1IM6ZcUwaAhrypLyvlA==
43044304

43054305
for-in@^1.0.2:
43064306
version "1.0.2"

0 commit comments

Comments
 (0)