Skip to content

Commit

Permalink
Merge pull request #19 from RotaractMora/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
SakinduRansindu authored Nov 18, 2024
2 parents ef1fbaa + eb70a6c commit f472c6a
Show file tree
Hide file tree
Showing 22 changed files with 10,065 additions and 285 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ permissions:
checks: write
contents: read
pull-requests: write

jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
Expand All @@ -15,12 +16,24 @@ jobs:
NEXT_PUBLIC_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_STORAGE_BUCKET }}
NEXT_PUBLIC_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_APP_ID: ${{ secrets.NEXT_PUBLIC_APP_ID }}
NEXT_PUBLIC_STATUS: $${{ secrets.NEXT_PUBLIC_STATUS }}
NEXT_PUBLIC_STATUS: ${{ secrets.NEXT_PUBLIC_STATUS }}
FIREBASE_DEPLOY_TOKEN: ${{ secrets.FIREBASE_DEPLOY_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.npm # Cache global npm cache
${{ github.workspace }}/.next/cache # Cache Next.js build cache
${{ github.workspace }}/functions/node_modules # Cache Firebase Functions dependencies
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies and build
run: npm ci && npm run build

Expand All @@ -30,3 +43,14 @@ jobs:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIRETEST_C524F }}
projectId: firetest-c524f

- name: Install Firebase CLI
run: npm install -g firebase-tools

- name: Deploy Firebase Functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_DEPLOY_TOKEN }}
run: |
cd functions
npm ci
firebase deploy --only functions --project firetest-c524f
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ yarn-error.log*
next-env.d.ts

# firebase files
.firebase
.firebase

# firebase emulator logs
ui-debug.log
firebase-debug.log
firestore-debug.log
37 changes: 37 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,42 @@
"destination": "/index.html"
}
]
},
"functions": [
{
"source": "functions",
"codebase": "default",
"region": "asia-southeast1",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
],
"emulators": {
"functions": {
"host": "localhost",
"port": 5001
},
"ui": {
"enabled": true,
"host": "localhost",
"port": 4000
},
"firestore": {
"host": "localhost",
"port": 8082
},
"hosting": {
"port": 5000
},
"singleProjectMode": true
}
}
38 changes: 38 additions & 0 deletions functions/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"google",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "tsconfig.dev.json"],
sourceType: "module",
},
ignorePatterns: [
"/lib/**/*", // Ignore built files.
"/generated/**/*", // Ignore generated files.
],
plugins: [
"@typescript-eslint",
"import",
],
rules: {
"quotes": ["error", "double"],
"import/no-unresolved": 0,
"indent": ["error", 2],
// Disable warning for require statements in ES Modules
"@typescript-eslint/no-var-requires": "off", // Allow 'require' in ESM
"import/no-commonjs": "off", // Allow 'require' in ESM, commonjs modules
// Change linebreak-style from error to warning
"linebreak-style": ["warn", "unix"],
},
};
10 changes: 10 additions & 0 deletions functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Compiled JavaScript files
lib/**/*.js
lib/**/*.js.map

# TypeScript v1 declaration files
typings/

# Node.js dependency directory
node_modules/
*.local
Loading

0 comments on commit f472c6a

Please sign in to comment.