Skip to content

Commit

Permalink
Merge pull request #96 from ThatNinjaGuy/develop
Browse files Browse the repository at this point in the history
Host the app on firebase #94
  • Loading branch information
ThatNinjaGuy authored Sep 28, 2024
2 parents 83b4e6c + 20caa6b commit 29d0c8b
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
tables.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
staffs.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
profile.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
orders.html,1727526431567,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
menu.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
inventory.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
index.html,1727526431566,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
favicon.ico,1727526431566,a31dff9ecb6b23a890382d0d5f0b7c38608c0c9124bdd841f6983fa4f5370b45
approve.html,1727526431552,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
_sitemap.html,1727526431549,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
+not-found.html,1727526431555,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
assets/assets/images/icon.621dcdbb9e3d7cbc5fc1db1fe90ba641.png,1727526431585,ac9648ac05bc9f1cd2b0c69769f6977beb2749e0893e7ddb616e411951c7ba04
assets/assets/fonts/SpaceMono-Regular.49a79d66bdea2debf1832bf4d7aca127.ttf,1727526431577,81cb13c8e3ad8314e7da7a33b861eb5ed0a21953dfb50d306ca04599490b7b5c
_expo/static/js/web/lottie_worker-Q23FJ6ZR-8a5c2bd5a54649dc84054ee79f47cf04.js,1727526431631,35ff523c30447dcbb28af0dc2bc08f6b29906ecd11d4c48b0569b2c94bdc4f26
_expo/static/js/web/lottie_svg-MJGYILXD-cb3b8ebe57f4821cc036b905526ccaf2.js,1727526431631,67ac239cc08697536c19cf219f24c0bec1c84b40bffc2af19c388642739a95c4
_expo/static/js/web/lottie_light_html-SLCECTRT-ee0fd9eea4a338ffc71614c9a324e4aa.js,1727526431626,38a4f10af4d733b38137f2e62d2ed734c9212aaf00a8cb9c76e57daffa363c33
_expo/static/js/web/lottie_light_canvas-B5UTTNXA-66803d44ed3b63ae0b0b73b2a5881f82.js,1727526431626,e098f9b14fc7c271db7acccf26a2ca9650d97a977285b36ab7e78fd53bb2c38a
_expo/static/js/web/lottie_light-KMJEUZFY-5a65cae126109d095e258f2d612e4cd9.js,1727526431628,7a3753b191569fd95f85391099f631ab0cc4d8194cff7c3007576f7549f23618
_expo/static/js/web/lottie_html-X3TYKVQI-cb5c80706f828cdd703c65c2af1317a1.js,1727526431627,8ef94a934ab31e5d7d6175ec24d438bce54c74742ebb61be22ae6a3b9792ac5b
_expo/static/js/web/lottie_canvas-CDSUBMCL-2313c8f59197b36035771c1745420ebb.js,1727526431626,a1bc2f34762598ab7b5a3f814ea073a64bde892f62136ca2f4ffa37547f1808b
_expo/static/js/web/index-d41d8cd98f00b204e9800998ecf8427e.js,1727526431589,f1b651238a58fe290baec6c5e32f3bdb1943dd2bd582f02569231f7a757c7837
_expo/static/js/web/entry-26bb21f171b5cc86879c244248a94d62.js,1727526431664,e16bb1a3e79a80bca3513a15d87fd0d13d123bb1b50e23960b61175bb989a83a
_expo/static/js/web/dotlottie-state-machine-manager-2E7RUGJG-c6a003d925300263f7737b6911721bd1.js,1727526431625,141df870b7f41e16f27eb038319068e49f0406568729fa1921296e73e8e3f563
_expo/static/js/web/dotlottie-audio-51cbb6fbd4933fe47d8bc179c183a36e.js,1727526431584,7f1f27e2997ba334d5985e1bd3c7250e8d177fb4a02425f9ea464c64c4fa0d5a
(tabs)/tables.html,1727526431551,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
(tabs)/profile.html,1727526431549,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
(tabs)/orders.html,1727526431548,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
(tabs)/menu.html,1727526431549,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
(tabs)/index.html,1727526431547,dc7149c692ea419fb82db156090f8be700b919b212ce78a86043205c53e3e95f
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "waiter-dev-ca07d"
}
}
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- feature/hosting
pull_request:
branches:
- main
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx expo export --platform web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WAITER_DEV_CA07D }}
channelId: live
projectId: waiter-dev-ca07d
21 changes: 21 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx expo export --platform web
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WAITER_DEV_CA07D }}
projectId: waiter-dev-ca07d
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ This project is a React Native application for managing a restaurant menu. It us

- npx expo start

## Building the web app

- npx expo export --platform web

## Running the web app preview build

- firebase hosting:channel:deploy preview_name

## Running the web app production build

- firebase deploy

## Building the APK

- npm install -g eas-cli
Expand Down
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
51 changes: 51 additions & 0 deletions firebaseConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { initializeApp } from "firebase/app";
import { initializeFirestore, CACHE_SIZE_UNLIMITED } from "firebase/firestore";
import {
getAuth,
initializeAuth,
getReactNativePersistence,
} from "firebase/auth";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { Platform } from "react-native";

// PROD configs
// {Replace DEV configs for PROD builds}

// DEV configs
const firebaseConfig = {
apiKey: "AIzaSyBNlZDqGxMyI83DbW4hY0qd4KAJA3ynW2Q",
authDomain: "waiter-dev-ca07d.firebaseapp.com",
projectId: "waiter-dev-ca07d",
storageBucket: "waiter-dev-ca07d.appspot.com",
messagingSenderId: "699328756162",
appId: "1:699328756162:web:f11e002f4f3dd23bd23e5b",
measurementId: "G-F4YF1WECQR",
};

const app = initializeApp(firebaseConfig);

let auth;

if (Platform.OS === "web") {
auth = getAuth(app);
// Set persistence for web
import("firebase/auth").then(
({ browserLocalPersistence, setPersistence }) => {
setPersistence(auth, browserLocalPersistence);
}
);
} else {
// Initialize auth with AsyncStorage persistence for React Native
auth = initializeAuth(app, {
persistence: getReactNativePersistence(AsyncStorage),
});
}

// Initialize Firestore with persistent local cache
const db = initializeFirestore(app, {
experimentalForceLongPolling: true,
synchronizeTabs: true,
cacheSizeBytes: CACHE_SIZE_UNLIMITED,
});

export { auth, db, firebaseConfig };

0 comments on commit 29d0c8b

Please sign in to comment.