diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-07-18 15:07:37 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-08-15 17:39:38 +0200 |
| commit | 71592249b2dd669b6f24f37bfb7b0f4e43b74998 (patch) | |
| tree | a6097dc7e5d94d06e99c65fdfe160e824395f50c /gui/packages/mobile | |
| parent | e84e87f4ce5a8c242f756566cdc6fb59a45f7bea (diff) | |
| download | mullvadvpn-71592249b2dd669b6f24f37bfb7b0f4e43b74998.tar.xz mullvadvpn-71592249b2dd669b6f24f37bfb7b0f4e43b74998.zip | |
Add workspaces
Diffstat (limited to 'gui/packages/mobile')
| -rw-r--r-- | gui/packages/mobile/.babelrc | 3 | ||||
| -rw-r--r-- | gui/packages/mobile/.flowconfig | 67 | ||||
| -rw-r--r-- | gui/packages/mobile/.gitattributes | 1 | ||||
| -rw-r--r-- | gui/packages/mobile/.gitignore | 56 | ||||
| -rw-r--r-- | gui/packages/mobile/App.js | 41 | ||||
| -rw-r--r-- | gui/packages/mobile/app.json | 4 | ||||
| -rw-r--r-- | gui/packages/mobile/index.js | 8 | ||||
| -rw-r--r-- | gui/packages/mobile/package.json | 31 | ||||
| -rw-r--r-- | gui/packages/mobile/postinstall.js | 29 |
9 files changed, 240 insertions, 0 deletions
diff --git a/gui/packages/mobile/.babelrc b/gui/packages/mobile/.babelrc new file mode 100644 index 0000000000..a9ce1369e6 --- /dev/null +++ b/gui/packages/mobile/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["react-native"] +} diff --git a/gui/packages/mobile/.flowconfig b/gui/packages/mobile/.flowconfig new file mode 100644 index 0000000000..fc7e2123ad --- /dev/null +++ b/gui/packages/mobile/.flowconfig @@ -0,0 +1,67 @@ +[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/ +node_modules/react-native/flow-github/ + +[options] +emoji=true + +module.system=hastez +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.75.0 diff --git a/gui/packages/mobile/.gitattributes b/gui/packages/mobile/.gitattributes new file mode 100644 index 0000000000..d42ff18354 --- /dev/null +++ b/gui/packages/mobile/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/gui/packages/mobile/.gitignore b/gui/packages/mobile/.gitignore new file mode 100644 index 0000000000..5d647565fa --- /dev/null +++ b/gui/packages/mobile/.gitignore @@ -0,0 +1,56 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle diff --git a/gui/packages/mobile/App.js b/gui/packages/mobile/App.js new file mode 100644 index 0000000000..b697fb660d --- /dev/null +++ b/gui/packages/mobile/App.js @@ -0,0 +1,41 @@ +// @flow + +import * as React from 'react'; +import { Component, Text, View, Platform, Styles } from 'reactxp'; + +const instructions = Platform.select({ + ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', + android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu', +}); + +type Props = {}; +export default class App extends Component<Props> { + render() { + return ( + <View style={styles.container}> + <Text style={styles.welcome}>Welcome to React Native!</Text> + <Text style={styles.instructions}>To get started, edit App.js</Text> + <Text style={styles.instructions}>{instructions}</Text> + </View> + ); + } +} + +const styles = { + container: Styles.createViewStyle({ + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#F5FCFF', + }), + welcome: Styles.createTextStyle({ + fontSize: 20, + textAlign: 'center', + margin: 10, + }), + instructions: Styles.createTextStyle({ + textAlign: 'center', + color: '#333333', + marginBottom: 5, + }), +}; diff --git a/gui/packages/mobile/app.json b/gui/packages/mobile/app.json new file mode 100644 index 0000000000..c6b64bcd1b --- /dev/null +++ b/gui/packages/mobile/app.json @@ -0,0 +1,4 @@ +{ + "name": "RXApp", + "displayName": "Mullvad VPN" +} diff --git a/gui/packages/mobile/index.js b/gui/packages/mobile/index.js new file mode 100644 index 0000000000..c6546b4989 --- /dev/null +++ b/gui/packages/mobile/index.js @@ -0,0 +1,8 @@ +// @flow + +import * as React from 'react'; +import RX from 'reactxp'; +import App from './App'; + +RX.App.initialize(true, true); +RX.UserInterface.setMainView(<App />); diff --git a/gui/packages/mobile/package.json b/gui/packages/mobile/package.json new file mode 100644 index 0000000000..16fdfad070 --- /dev/null +++ b/gui/packages/mobile/package.json @@ -0,0 +1,31 @@ +{ + "name": "mobile", + "version": "0.1.0", + "private": true, + "productName": "Mullvad VPN", + "description": "Mullvad VPN client", + "author": { + "name": "Mullvad VPN", + "email": "support@mullvad.net" + }, + "repository": "https://github.com/mullvad/mullvadvpn-app", + "license": "GPL-3.0", + "dependencies": { + "@mullvad/components": "0.1.0", + "react": "^16.0.0", + "react-native": "^0.56", + "reactxp": "^1.3.3" + }, + "devDependencies": { + "@babel/cli": "7.0.0-beta.47", + "@babel/core": "7.0.0-beta.47", + "babel-preset-react-native": "^5" + }, + "scripts": { + "postinstall": "node ./postinstall.js", + "eject": "react-native eject", + "develop:android": "react-native run-android --simulator", + "develop:ios": "react-native run-ios --simulator", + "test": "echo '1' ; exit 1" + } +} diff --git a/gui/packages/mobile/postinstall.js b/gui/packages/mobile/postinstall.js new file mode 100644 index 0000000000..50234eae67 --- /dev/null +++ b/gui/packages/mobile/postinstall.js @@ -0,0 +1,29 @@ +// +// React-native CLI doesn't function properly in workspace configuration. +// +// Symlinking `/gui/node_modules/react-native` to `/gui/packages/mobile/node_modules/react-native` +// solves this. See rn-cli.config.js for project roots override. +// + +const path = require('path'); +const fs = require('fs'); + +const sourcePath = path.resolve(path.join(__dirname, '../../node_modules/react-native')); +const symlinkPath = path.join(__dirname, 'node_modules/react-native'); + +try { + console.log('Removing a symlink to react-native'); + fs.unlinkSync(symlinkPath); +} catch (error) { + if (error.code !== 'ENOENT') { + throw error; + } +} + +try { + console.log('Adding a symlink to react-native'); + fs.symlinkSync(sourcePath, symlinkPath); + console.log('Done'); +} catch (error) { + console.error('Cannot symlink react-native: ' + error.message); +} |
