Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1068

Merged
merged 13 commits into from
Feb 21, 2023
Merged

Dev #1068

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2019
ecmaVersion: 2020
},
env: {
browser: true,
Expand Down
38 changes: 31 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,44 @@
# ... GITHUB ACIONS CI/CD WORKFLOW ...
# ....................................
name: Docker Image CI
# ... when to trigger this project
# [β„Ή] NOTE:when to trigger this project
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
# ... declaring ENV variables to be used in the project-CI/CD
# [β„Ή] NOTE: declaring ENV variables to be
# [β„Ή] NOTE: used in the project-CI/CD
env:
# [β„Ή] other
PORT: ${{secrets.PORT}}
# [β„Ή] hasura
VITE_HASURA_DB_URL: ${{secrets.VITE_HASURA_DB_URL}}
VITE_HASURA_DB_TOKEN: ${{secrets.VITE_HASURA_DB_TOKEN}}
# [β„Ή] firebase
VITE_FIREBASE_DB_API_KEY: ${{secrets.VITE_FIREBASE_DB_API_KEY }}
VITE_FIREBASE_DB_AUTH_DOMAIN: ${{secrets.VITE_FIREBASE_DB_AUTH_DOMAIN}}
VITE_FIREBASE_DB_PROJECT_ID: ${{secrets.VITE_FIREBASE_DB_PROJECT_ID}}
VITE_FIREBASE_DB_DATABASE_URL: ${{secrets.VITE_FIREBASE_DB_DATABASE_URL}}
VITE_REDIS_CONNECTION_URL: ${{secrets.VITE_REDIS_CONNECTION_URL}}
# ... JOBS TO DO WITH GITHUB WORFLOWS;
VITE_FIREBASE_DB_STORAGE_BUCKET: ${{secrets.VITE_FIREBASE_DB_STORAGE_BUCKET}}
VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN: ${{secrets.VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN}}
VITE_FIREBASE_DB_PROJECT_ID_MAIN: ${{secrets.VITE_FIREBASE_DB_PROJECT_ID_MAIN}}
VITE_FIREBASE_DB_DATABASE_URL_MAIN: ${{secrets.VITE_FIREBASE_DB_DATABASE_URL_MAIN}}
# [β„Ή] redis
VITE_REDIS_HOST: ${{secrets.VITE_REDIS_HOST}}
VITE_REDIS_PORT: ${{secrets.VITE_REDIS_PORT}}
VITE_REDIS_PASS: ${{secrets.VITE_REDIS_PASS}}
VITE_REDIS_CACHE_DB: ${{secrets.VITE_REDIS_CACHE_DB}}
VITE_REDIS_BULL_DB: ${{secrets.VITE_REDIS_BULL_DB}}
# [β„Ή] discord
VITE_DISCORD_OAUTH_URL: ${{secrets.VITE_DISCORD_OAUTH_URL}}
# [β„Ή] NOTE: JOBS TO DO WITH GITHUB WORFLOWS;
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# ... instantiate a `.env` file for the JOB to access;
# [β„Ή] instantiate a `.env` file for the JOB to access;
- name: create env file
run: |
touch .env
Expand All @@ -33,8 +49,16 @@ jobs:
echo VITE_FIREBASE_DB_AUTH_DOMAIN="${{secrets.VITE_FIREBASE_DB_AUTH_DOMAIN}}" >> .env
echo VITE_FIREBASE_DB_PROJECT_ID="${{secrets.VITE_FIREBASE_DB_PROJECT_ID}}" >> .env
echo VITE_FIREBASE_DB_DATABASE_URL="${{secrets.VITE_FIREBASE_DB_DATABASE_URL}}" >> .env
echo VITE_REDIS_CONNECTION_URL="${{secrets.VITE_REDIS_CONNECTION_URL}}" >> .env
# ... build the DOCKER IMAGE CONTAINER;
echo VITE_FIREBASE_DB_STORAGE_BUCKET="${{secrets.VITE_FIREBASE_DB_STORAGE_BUCKET}}" >> .env
echo VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN="${{secrets.VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN}}" >> .env
echo VITE_FIREBASE_DB_PROJECT_ID_MAIN="${{secrets.VITE_FIREBASE_DB_PROJECT_ID_MAIN}}" >> .env
echo VITE_FIREBASE_DB_DATABASE_URL_MAIN="${{secrets.VITE_FIREBASE_DB_DATABASE_URL_MAIN}}" >> .env
echo VITE_REDIS_HOST="${{secrets.VITE_REDIS_HOST}}" >> .env
echo VITE_REDIS_PORT="${{secrets.VITE_REDIS_PORT}}" >> .env
echo VITE_REDIS_PASS="${{secrets.VITE_REDIS_PASS}}" >> .env
echo VITE_REDIS_CACHE_DB="${{secrets.VITE_REDIS_CACHE_DB}}" >> .env
echo VITE_REDIS_BULL_DB="${{secrets.VITE_REDIS_BULL_DB}}" >> .env
# [β„Ή] build the DOCKER IMAGE CONTAINER;
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag my-image-name:$(date +%s)
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ certs/*
.env

WEBSITE-DEV-README.md
datalog/
datalog/

# [PERSONAL]
.vscode/
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
12 changes: 10 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100
}
"singleAttributePerLine": true,
"bracketSameLine": false,
"printWidth": 120,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"svelteSortOrder" : "scripts-options-markup-styles",
"svelteStrictMode": false,
"svelteAllowShorthand": true
}
45 changes: 41 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// DOC: https://stackoverflow.com/questions/64365300/how-can-i-remove-unused-imports-declarations-from-the-entire-project-of-react-ty
// DOC: https://stackoverflow.com/questions/46722701/is-there-a-way-to-remove-unused-imports-and-declarations-from-angular-2
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true,
"source.sortMembers": true
// "source.fixAll": true,
// "source.organizeImports": true,
// "source.sortMembers": true
},
// NOTE: custom highlighter for data
"todohighlight.keywords": [
Expand Down Expand Up @@ -38,5 +38,42 @@
"backgroundColor": "red",
"overviewRulerColor": "grey"
}
]
],
// DOC: https://discord.com/channels/457912077277855764/1036919129782878218
// DOC: https://discord.com/channels/457912077277855764/1036369208721813554
"svelte.plugin.svelte.compilerWarnings": {
"a11y-click-events-have-key-events": "ignore",
"a11y-aria-attributes": "ignore",
"a11y-incorrect-aria-attribute-type": "ignore",
"a11y-unknown-aria-attribute": "ignore",
"a11y-hidden": "ignore",
"a11y-misplaced-role": "ignore",
"a11y-unknown-role": "ignore",
"a11y-no-abstract-role": "ignore",
"a11y-no-redundant-roles": "ignore",
"a11y-role-has-required-aria-props": "ignore",
"a11y-accesskey": "ignore",
"a11y-autofocus": "ignore",
"a11y-misplaced-scope": "ignore",
"a11y-positive-tabindex": "ignore",
"a11y-invalid-attribute": "ignore",
"a11y-missing-attribute": "ignore",
"a11y-img-redundant-alt": "ignore",
"a11y-label-has-associated-control": "ignore",
"a11y-media-has-caption": "ignore",
"a11y-distracting-elements": "ignore",
"a11y-structure": "ignore",
"a11y-mouse-events-have-key-events": "ignore",
"a11y-missing-content": "ignore",
},
// DOC: https://stackoverflow.com/a/49777201/8421215
"editor.folding": true,
"editor.showFoldingControls": "always",
"editor.foldingStrategy": "indentation",
"editor.foldingImportsByDefault": true,
// DOC: https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder
"maptz.regionfolder": {
"collapseAllRegions": true,
"collapseDefaultRegionsOnOpen": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ COMPONENT JS (w/ TS)

<script lang="ts">

//#region Package Imports
// IMPORTS GO HERE
//#endregion Package Imports

//#region Assets Imports
import profile_avatar from './assets/profile-avatar.svg';
//#endregion Assets Imports

// ~~~~~~~~~~~~~~~~~~~~~
// COMPONENT VARIABLES
// ~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -30,6 +38,12 @@ COMPONENT HTML

<!-- HTML GOES HERE -->

<img
src={profile_avatar}
alt='Profile Avatar Icon'
title='Profile Avatar Icon'
/>

<!-- ===============
COMPONENT STYLE
=================-->
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ COPY package.json package-lock.json ./
# [β„Ή] example-use: https://superuser.com/questions/1055060/how-to-install-a-specific-package-version-in-alpine
# [β„Ή] example-use: https://superuser.com/questions/1198215/fixate-version-alpine-linux-apk-package-in-container
RUN apk add --no-cache \
python3=3.10.9-r0 \
python3=3.10.10-r0 \
make=4.3-r0 \
g++=11.2.1_git20220219-r2 \
&& npm i --omit=optional
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY package.json package-lock.json ./
# [β„Ή] example-use: https://superuser.com/questions/1055060/how-to-install-a-specific-package-version-in-alpine
# [β„Ή] example-use: https://superuser.com/questions/1198215/fixate-version-alpine-linux-apk-package-in-container
RUN apk add --no-cache \
python3=3.10.9-r0 \
python3=3.10.10-r0 \
make=4.3-r0 \
g++=11.2.1_git20220219-r2 \
&& npm i --omit=optional
Expand Down
22 changes: 16 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ dev-clean:
echo 'Removing Old DEV Logs'
rm -r ./datalog/

# from Develop and assuming your master is up to date with origin/master
# git-post-main-pr:
# git checkout main
# git pull origin main
# git checkout dev
# git reset --hard main
git-post-main-pr:
# from Develop and assuming your master is up to date with origin/master
echo 'Checking out to MAIN'
git checkout main
echo 'Pulling new changes from MAIN'
git pull origin main
echo 'Checkout to DEV'
git checkout dev
echo 'Resetting to MAIN'
git reset --hard main

git-del-branches-w-origin:
echo 'Deleting branches not present in origin + /dev'
# Original command (below) is without \(...\) syntax
# git fetch -p ; git branch -r | awk '{print $$1}' | egrep -v -f /dev/fd/0 <\(git branch -vv | grep origin\) | awk '{print $$1}' | xargs git branch -D
# git branch --merged | grep -v "*" | grep -v "main" | xargs git branch -d
57 changes: 56 additions & 1 deletion README-DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,59 @@ Invoke-RestMethod -Method "POST" -Uri 'https://betarena-scores-platform.herokuap

If you wish to develop new components for the platform, please follow the following guide of how the components must be structured:

- use the `console.group` to group your `devTool` logs and hafve it working in the `DEV` environment.
- use the `console.group` to group your `devTool` logs and hafve it working in the `DEV` environment.

### References

| Ref. Num. | Sources |
| ------ | ------ |
| [1] `[AUTH] [Moralis]` |
https://moralis.io/create-a-web3-firebase-login-with-metamask/
https://docs.moralis.io/authentication-api/integrations/firebase-nodejs
https://moralis.io/web3-firebase-authentication-create-a-web3-sign-in-with-moralis/
https://moralisweb3.github.io/firebase-extensions/service-account-converter/
https://moralisweb3.github.io/Moralis-JS-SDK/demos/firebase-auth-ext/
https://admin.moralis.io/users |
| [2] `[R&D]` |
https://stackoverflow.com/questions/43691808/http-performance-many-small-requests-or-one-big-one
https://svelte.dev/repl/ec6f6b61329f4f43ae049464d73d8158?version=3.23.1
https://svelte.dev/repl/16b375da9b39417dae837b5006799cb4?version=3.25.0
| [3] `[SVELTEKIT]` `[HOOKS]` |
https://dev.to/krowemoh/sveltekit-hooks-2bii
https://dev.to/kudadam/sveltekit-hooks-everything-you-need-to-know-3l39
https://rodneylab.com/sveltekit-session-cookies/
https://stackoverflow.com/questions/71105799/sveltekit-pass-data-from-server-to-browser
https://github.com/sveltejs/kit/pull/3993
https://stackoverflow.com/questions/69066169/how-to-implement-cookie-authentication-sveltekit-mongodb
https://blog.logrocket.com/authentication-svelte-using-cookies/
| [4] `[AUTH] [DISCORD]` |
https://www.reddit.com/r/Firebase/comments/n4uv1o/sign_in_with_discord/
https://github.com/luizkc/firebase-discord-oauth2-example
https://stackoverflow.com/questions/70171124/discord-oauth2-with-firebase-functions
https://stackoverflow.com/questions/53992730/how-would-i-authorize-users-using-discord-oauth2-0-for-firebase-authentication-o
|

#### Documenting

https://stackoverflow.com/questions/63668154/describe-and-hint-what-parameters-a-function-requires

### Configs

#### Prettier

```
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"singleAttributePerLine": true,
"bracketSameLine": false,
"printWidth": 120, // best with = 50 or 120
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"svelteSortOrder" : "scripts-options-markup-styles",
"svelteStrictMode": false,
"svelteAllowShorthand": true
}
```
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
</h1>

![example workflow](https://github.com/Betarena/scores/actions/workflows/docker-image.yml/badge.svg)
![example workflow](https://github.com/Betarena/scores/actions/workflows/deploy.yml/badge.svg)
[![DeepSource](https://deepsource.io/gh/Betarena/scores.svg/?label=active+issues&token=fz7n_ybCLUD7T9tvU2qY6yoU)](https://deepsource.io/gh/Betarena/scores/?ref=repository-badge)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

<details open="open">
<summary>Table of Contents</summary>
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ services:
restart: always
environment:
PORT: ${PORT}
VITE_DISCORD_OAUTH_URL: ${VITE_DISCORD_OAUTH_URL}
VITE_HASURA_DB_URL: ${VITE_HASURA_DB_URL}
VITE_HASURA_DB_TOKEN: ${VITE_HASURA_DB_TOKEN}
VITE_FIREBASE_DB_API_KEY: ${VITE_FIREBASE_DB_API_KEY}
VITE_FIREBASE_DB_AUTH_DOMAIN: ${VITE_FIREBASE_DB_AUTH_DOMAIN}
VITE_FIREBASE_DB_PROJECT_ID: ${VITE_FIREBASE_DB_PROJECT_ID}
VITE_FIREBASE_DB_DATABASE_URL: ${VITE_FIREBASE_DB_DATABASE_URL}
VITE_FIREBASE_DB_STORAGE_BUCKET: ${VITE_FIREBASE_DB_STORAGE_BUCKET}
VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN: ${VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN}
VITE_FIREBASE_DB_PROJECT_ID_MAIN: ${VITE_FIREBASE_DB_PROJECT_ID_MAIN}
VITE_FIREBASE_DB_DATABASE_URL_MAIN: ${VITE_FIREBASE_DB_DATABASE_URL_MAIN}
VITE_REDIS_HOST: ${VITE_REDIS_HOST}
VITE_REDIS_PORT: ${VITE_REDIS_PORT}
VITE_REDIS_PASS: ${VITE_REDIS_PASS}
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ services:
restart: always
environment:
PORT: ${PORT}
VITE_DISCORD_OAUTH_URL: ${VITE_DISCORD_OAUTH_URL}
VITE_HASURA_DB_URL: ${VITE_HASURA_DB_URL}
VITE_HASURA_DB_TOKEN: ${VITE_HASURA_DB_TOKEN}
VITE_FIREBASE_DB_API_KEY: ${VITE_FIREBASE_DB_API_KEY}
VITE_FIREBASE_DB_AUTH_DOMAIN: ${VITE_FIREBASE_DB_AUTH_DOMAIN}
VITE_FIREBASE_DB_PROJECT_ID: ${VITE_FIREBASE_DB_PROJECT_ID}
VITE_FIREBASE_DB_DATABASE_URL: ${VITE_FIREBASE_DB_DATABASE_URL}
VITE_FIREBASE_DB_STORAGE_BUCKET: ${VITE_FIREBASE_DB_STORAGE_BUCKET}
VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN: ${VITE_FIREBASE_DB_AUTH_DOMAIN_MAIN}
VITE_FIREBASE_DB_PROJECT_ID_MAIN: ${VITE_FIREBASE_DB_PROJECT_ID_MAIN}
VITE_FIREBASE_DB_DATABASE_URL_MAIN: ${VITE_FIREBASE_DB_DATABASE_URL_MAIN}
VITE_REDIS_HOST: ${VITE_REDIS_HOST}
VITE_REDIS_PORT: ${VITE_REDIS_PORT}
VITE_REDIS_PASS: ${VITE_REDIS_PASS}
Expand Down
Loading