An example of an inventory app to administrate small business that runs in ios, android, linux, mac & windows.
- Node >= 8
- Yarn
- Install the graphql-yoga server from here.
$ git clone https://github.com/cesaraaron/my-app-universal
$ cd my-app-universal
$ yarn install
Runs the mobile app in development mode, open it in the Expo app on your phone to view it.
Runs the desktop app in development mode using electron.
In the login screen use '123456' for user & password if you haven't added a user in the graphql-yoga server.
You should run this command when changing the graphql schema in the server or adding a query in the src/queries.ts
file to regenerate the src/__generated__/types.ts
Before running this command run 'yarn dev' in the graphql server
- Deploy first the server.
- Create a
.env.production
file on the root directory with the ip of your server. E.g:
HTTP_ENDPOINT="http://54.210.243.224:4000/"
WS_ENDPOINT="ws://54.210.243.224:4000/"
- Build the apps
# Ios app
$ npx exp build:ios
# Android app
$ npx exp build:android
# Desktop apps
$ yarn electron-pack
If you need to build the desktop app for a specific platform:
$ yarn electron-pack --win
$ yarn electron-pack --mac
$ yarn electron-pack --linux
The mobile app can auto update outside the box through OTA updates.
For the desktop updates you need configure either your own generic server or use a custom provider like github. We are gonna be configuring the former.
First off, connect to your server using ssh and run:
$ git clone https://github.com/cesaraaron/my-app-universal && cd my-app-universal
$ yarn install
Now you need to get the ip of your server and update the ./electron-builder.json publish.url field with your server ip.
To do it automatically:
$ yarn update-ip ip=${your server ip here}
The express server for auto updates runs on port
3333
so If you're gonna add it manually make sure to add the3333
port to the ip.
Then:
# Build the binaries
$ yarn electron-pack
# Build the auto update server
$ yarn updates-server
# Run the auto update server in the background with pm2
$ npx pm2 start electron-builder-server.prod.js
Now you can download your binaries under http://${your ip}:3333/${name of the binary}
.
- react
- react-native
- react-native-web
- react-navigation
- native-base
- ant-design
- apollo-client
- expo
- electron
This project is licensed under the MIT License - see the LICENSE.md file for details