Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions .github/workflows/build-deploy-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- master
workflow_dispatch:

jobs:
Build:
Expand All @@ -14,13 +15,13 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: '22.x'

- name: Install dependencies
- name: Install web dependencies
run: yarn install
working-directory: ./bs3

- name: Build
- name: Build web
run: yarn build
working-directory: ./bs3
env:
Expand All @@ -31,8 +32,25 @@ jobs:
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }}
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.REACT_APP_FIREBASE_MEASUREMENT_ID }}

- name: Install function dependencies
run: yarn install
working-directory: ./bs3-functions/node-functions

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

- name: Create service account file
run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_BS3APP_DFB63 }}' > $HOME/gcloud.json

- name: Deploy functions
run: firebase deploy --only functions --project bs3app-dfb63
working-directory: ./bs3-functions
env:
PERPLEXITY_SONAR_API_KEY: ${{ secrets.PERPLEXITY_SONAR_API_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: $HOME/gcloud.json

- name: Deploy to Firebase
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
entryPoint: ./bs3
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: '22.x'

- name: Install dependencies
- name: Install web dependencies
run: yarn install
working-directory: ./bs3

- name: Build
- name: Build web
run: yarn build
working-directory: ./bs3
env:
Expand All @@ -33,3 +33,13 @@ jobs:
REACT_APP_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_FIREBASE_MESSAGING_SENDER_ID }}
REACT_APP_FIREBASE_APP_ID: ${{ secrets.REACT_APP_FIREBASE_APP_ID }}
REACT_APP_FIREBASE_MEASUREMENT_ID: ${{ secrets.REACT_APP_FIREBASE_MEASUREMENT_ID }}

- name: Install function dependencies
run: yarn install
working-directory: ./bs3-functions/node-functions

- name: Build functions
run: yarn build
working-directory: ./bs3-functions/node-functions
env:
PERPLEXITY_SONAR_API_KEY: ${{ secrets.PERPLEXITY_SONAR_API_KEY }}
69 changes: 69 additions & 0 deletions bs3-functions/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
.firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# dataconnect generated files
.dataconnect
Empty file added bs3-functions/README.md
Empty file.
53 changes: 53 additions & 0 deletions bs3-functions/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"functions": [
{
"source": "node-functions",
"codebase": "default",
"ignore": [
"node_modules",
".git",
"firebase-debug.log",
"firebase-debug.*.log",
"*.local"
],
"runtime": "nodejs22",
"predeploy": [
"yarn --cwd "$RESOURCE_DIR" lint",
"yarn --cwd "$RESOURCE_DIR" build"
]
}
],
"emulators": {
"functions": {
"port": 5001
},
"firestore": {
"port": 8080
},
"hosting": {
"port": 5000
},
"ui": {
"enabled": true
},
"singleProjectMode": true
}
}
4 changes: 4 additions & 0 deletions bs3-functions/firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}
12 changes: 12 additions & 0 deletions bs3-functions/firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rules_version = '2';

service cloud.firestore {
match /databases/{database}/documents {

// This configuration will enable unrestricted access to your Firestore database, allowing any user to read from and write to all documents.
// Important Warning: Allowing unrestricted access to your Firestore database is highly discouraged for production applications as it exposes your database to potential malicious activities, including unauthorized data access, data modification, and data deletion. Always aim to implement and maintain appropriate security rules that match your application's data access requirements.
match /{document=**} {
allow read, write: if true;
}
}
}
36 changes: 36 additions & 0 deletions bs3-functions/node-functions/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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],
"object-curly-spacing": "off",
"block-spacing": "off",
"max-len": "off",
},
};
10 changes: 10 additions & 0 deletions bs3-functions/node-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
35 changes: 35 additions & 0 deletions bs3-functions/node-functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"build:watch": "tsc --watch",
"serve": "npm run build && firebase emulators:start --only functions,pubsub",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "22"
},
"main": "lib/index.js",
"dependencies": {
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"axios": "^1.11.0",
"dotenv": "^17.2.2",
"firebase-admin": "^12.6.0",
"firebase-functions": "^6.0.1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.25.4",
"firebase-functions-test": "^3.1.0",
"typescript": "^5.7.3"
},
"private": true
}
Loading