Skip to content

Commit

Permalink
fix(js): build & run berty-app
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy authored and gfanton committed Oct 23, 2019
1 parent 01929d2 commit 8150824
Show file tree
Hide file tree
Showing 90 changed files with 7,584 additions and 1,387 deletions.
1 change: 1 addition & 0 deletions js/.env.development
@@ -0,0 +1 @@
NODE_ENV=development
2 changes: 2 additions & 0 deletions js/.gitignore
Expand Up @@ -67,6 +67,7 @@ lerna-debug.log
buck-out/
\.buckd/
*.keystore
!debug.keystore

# Firebase
google-services.json
Expand Down Expand Up @@ -130,6 +131,7 @@ jsconfig.json

# Environment
.env.*
!.env.development

# Fix code factor __generated__ exclude patterns
__generated__/
Expand Down
3 changes: 2 additions & 1 deletion js/package.json
Expand Up @@ -29,7 +29,8 @@
"nohoist": [
"**/react-native",
"**/react-native-*",
"**/@react-native-community/*"
"**/@react-native-community/*",
"**/hermes-engine"
]
},
"dependencies": {
Expand Down
34 changes: 5 additions & 29 deletions js/packages/berty-app/.flowconfig
Expand Up @@ -5,14 +5,6 @@
; 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
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

Expand All @@ -21,7 +13,7 @@ node_modules/react-native/Libraries/polyfills/.*
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
Expand All @@ -42,27 +34,11 @@ module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

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.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

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.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
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'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand Down Expand Up @@ -96,4 +72,4 @@ untyped-import
untyped-type-import

[version]
^0.98.0
^0.105.0
3 changes: 2 additions & 1 deletion js/packages/berty-app/.gitignore
Expand Up @@ -20,7 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
xcshareddata

# Android/IntelliJ
#
Expand All @@ -40,6 +40,7 @@ yarn-error.log
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
Expand Down
106 changes: 52 additions & 54 deletions js/packages/berty-app/App.tsx
Expand Up @@ -25,22 +25,22 @@ import {
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen'

import BertyCore from '@berty-tech/react-native-core'
// import BertyCore from '@berty-tech/react-native-core'
//
// const startDaemon = (): void => {
// console.log('BertyCore:', BertyCore)
// if (BertyCore.invoke) {
// const promise = BertyCore.invoke('/berty.daemon.Daemon/Start', '')
// console.log('BertyCore.invoke("/berty.daemon.Daemon/Start", "")', promise)
// if (promise && promise.then) {
// promise.then((result: any) => console.log('.then():', result))
// }
// }
// }

const startDaemon = (): void => {
console.log('BertyCore:', BertyCore)
if (BertyCore.invoke) {
const promise = BertyCore.invoke('/berty.daemon.Daemon/Start', '')
console.log('BertyCore.invoke("/berty.daemon.Daemon/Start", "")', promise)
if (promise && promise.then) {
promise.then((result: any) => console.log('.then():', result))
}
}
}

const DebugStartDaemonButton = () => (
<Button title="Start daemon" onPress={startDaemon} />
)
// const DebugStartDaemonButton = () => (
// <Button title="Start daemon" onPress={startDaemon} />
// )

const styles = StyleSheet.create({
scrollView: {
Expand Down Expand Up @@ -85,50 +85,48 @@ const App = () => {
return (
<Fragment>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}
>
<Header />
{/*global.HermesInternal == null ? null : (
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}
>
<Header />
{/*global.HermesInternal == null ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)*/}
<View style={styles.engine}>
{/*<View style={styles.engine}>
<DebugStartDaemonButton />
</View>
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
</View>*/}
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.js</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</Fragment>
)
}
Expand Down

0 comments on commit 8150824

Please sign in to comment.