Skip to content

Commit

Permalink
Add Firebase configuration files and settings
Browse files Browse the repository at this point in the history
  • Loading branch information
coji committed Jan 13, 2024
1 parent 39e8395 commit 9e2b958
Show file tree
Hide file tree
Showing 12 changed files with 850 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "remix-spa-example"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- run: pnpm i && pnpm build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_REMIX_SPA_EXAMPLE }}'
channelId: live
projectId: remix-spa-example
23 changes: 23 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false
- run: pnpm i && pnpm build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_REMIX_SPA_EXAMPLE }}'
projectId: remix-spa-example
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
/build
/public/build
.env
firestore-debug.log
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": true,
"source.organizeImports.biome": true
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
}
13 changes: 13 additions & 0 deletions app/services/firebase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from 'firebase/app'

const firebaseConfig = {
apiKey: 'AIzaSyCTNcpaBcn8bzjDGhWVpaQ6YOnZzHECwUE',
authDomain: 'remix-spa-example.firebaseapp.com',
projectId: 'remix-spa-example',
storageBucket: 'remix-spa-example.appspot.com',
messagingSenderId: '555137498198',
appId: '1:555137498198:web:380bd830ee347237890ff7',
}

export const app = initializeApp(firebaseConfig)
20 changes: 20 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
4 changes: 4 additions & 0 deletions firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}
9 changes: 9 additions & 0 deletions firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rules_version = '2';

service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"dev": "remix vite:dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "http-server -p 3000 build/client/",
"typecheck": "tsc"
"typecheck": "tsc",
"ci": "pnpm run lint && pnpm run typecheck"
},
"dependencies": {
"@conform-to/react": "^0.9.1",
Expand All @@ -19,6 +20,7 @@
"@remix-run/react": "^2.5.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"firebase": "^10.7.1",
"http-server": "^14.1.1",
"lucide-react": "^0.309.0",
"react": "^18.2.0",
Expand Down
Loading

0 comments on commit 9e2b958

Please sign in to comment.