Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fix Flow

* Add CircleCI config
  • Loading branch information
charpeni authored Oct 5, 2018
1 parent 99b3802 commit 3d6813c
Show file tree
Hide file tree
Showing 7 changed files with 1,545 additions and 4 deletions.
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
aliases:
- &save-cache-yarn
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- &restore-cache-yarn
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}

defaults: &defaults
working_directory: ~/react-native-image-picker
docker:
- image: circleci/node:10

version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- restore_cache: *restore-cache-yarn
- run:
name: Yarn Install
command: |
yarn install --no-progress --non-interactive --cache-folder ~/.cache/yarn
- run:
name: Flow
command: |
yarn flow
- save_cache: *save-cache-yarn
69 changes: 69 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

; Ignore metro
.*/node_modules/metro/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/

[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*

munge_underscores=true

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'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.82.0
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ xcuserdata/
### Node
node_modules
*.log
yarn.lock

## Android iml
*.iml

.vscode/
.vscode/
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Example/
images/
node_modules/
yarn.lock
2 changes: 1 addition & 1 deletion index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ declare export function launchImageLibrary(options: ?Options, callback: (respons
declare export function launchImageLibrary(callback: (response: Response) => any): void;

declare export default {
showImagePicker(options: ?Options, callback: (response: Response) => any): void
showImagePicker(options: ?Options, callback: (response: Response) => any): void,
launchCamera(options: ?Options, callback: (response: Response) => any): void,
launchImageLibrary(callback: (response: Response) => any): void,
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
"types": "./index.d.ts",
"license": "MIT",
"devDependencies": {
"flow-bin": "0.82.0",
"husky": "^1.1.0",
"lint-staged": "^7.3.0",
"prettier": "^1.14.3"
"prettier": "1.14.3"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 3d6813c

Please sign in to comment.