-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial code for Cloud Function
- Loading branch information
Showing
9 changed files
with
8,315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: ["tsconfig.json", "tsconfig.dev.json"], | ||
sourceType: "module", | ||
}, | ||
ignorePatterns: [ | ||
"/lib/**/*", // Ignore built files. | ||
], | ||
plugins: [ | ||
"@typescript-eslint", | ||
"import", | ||
], | ||
rules: { | ||
// Project-specific ESLint rules | ||
'array-bracket-spacing': 'error', | ||
'arrow-spacing': 'error', | ||
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }], | ||
'comma-style': 'error', | ||
'eqeqeq': 'error', | ||
'indent': ['error', 2, { 'SwitchCase': 1 }], | ||
'keyword-spacing': 'error', | ||
'newline-per-chained-call': 'error', | ||
'no-confusing-arrow': 'error', | ||
'no-duplicate-imports': 'error', | ||
'no-else-return': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-param-reassign': 'error', | ||
'no-useless-constructor': 'error', | ||
'no-whitespace-before-property': 'error', | ||
'nonblock-statement-body-position': 'error', | ||
'object-curly-spacing': ['error', 'always'], | ||
'operator-linebreak': 'error', | ||
'prefer-arrow-callback': 'error', | ||
'prefer-const': 'error', | ||
'prefer-template': 'error', | ||
'semi': 'error', | ||
'space-before-blocks': 'error', | ||
'space-before-function-paren': ['error', { 'named': 'never' }], | ||
'space-in-parens': 'error', | ||
'space-infix-ops': 'error', | ||
'spaced-comment': 'error', | ||
'template-curly-spacing': 'error', | ||
|
||
// Project-specific ESLint rules for TypeScript | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
'@typescript-eslint/prefer-for-of': 'error', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types' : 'off', | ||
'@typescript-eslint/no-floating-promises': ['error', { ignoreIIFE: true }], | ||
'@typescript-eslint/no-unused-vars': ['off'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "kipr-321905" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Deploy to Google Cloud | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Needed to produce an OIDC token, which is used for Workload Identity Federation with Google Cloud | ||
id-token: write | ||
contents: read | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: checkout-prefix | ||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
- name: Install firebase-tools | ||
run: npm install -g firebase-tools | ||
- name: Authenticate to Google | ||
uses: 'google-github-actions/auth@v2' | ||
with: | ||
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER_ID }} | ||
project_id: ${{ secrets.GCP_PROJECT_ID }} | ||
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_ADDRESS }} | ||
create_credentials_file: true | ||
export_environment_variables: true | ||
cleanup_credentials: true | ||
- name: Install dependencies | ||
run: npm install | ||
working-directory: checkout-prefix | ||
- name: Build | ||
run: npm run build | ||
working-directory: checkout-prefix | ||
- name: Deploy functions | ||
id: deployFunctions | ||
run: npm run deploy | ||
working-directory: checkout-prefix | ||
- name: Output firebase debug log on deployment failure | ||
if: always() && (steps.deployFunctions.outcome == 'failure') | ||
run: cat firebase-debug.log | ||
working-directory: checkout-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"functions": { | ||
"predeploy": [ | ||
"npm --prefix \"$RESOURCE_DIR\" run lint", | ||
"npm --prefix \"$RESOURCE_DIR\" run build" | ||
], | ||
"source": "." | ||
}, | ||
"emulators": { | ||
"auth": { | ||
"port": 9099 | ||
}, | ||
"firestore": { | ||
"port": 8080 | ||
}, | ||
"ui": { | ||
"enabled": true, | ||
"port": 4001 | ||
}, | ||
"functions": { | ||
"enabled": true, | ||
"port": 5001 | ||
}, | ||
"singleProjectMode": true | ||
} | ||
} |
Oops, something went wrong.