Skip to content

Commit

Permalink
Merge pull request #385 from P4-Games/develop
Browse files Browse the repository at this point in the history
Deploy 20240722
  • Loading branch information
mpefaur authored Jul 22, 2024
2 parents 3b3814d + 1769efb commit c445268
Show file tree
Hide file tree
Showing 92 changed files with 3,591 additions and 2,146 deletions.
28 changes: 24 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
**/node_modules/*
// .eslintignore
build/*
dist/*
public/*
scripts/
**/out/*
**/node_modules/*
**/prisma
**/prisma.js

**/.next/*
**/src/context/abis/*
**/src/styles/*
**/_static/*
next.config.js

vite.config.js
vite.config.ts

src/reportWebVitals.js
src/service-worker.js
src/serviceWorkerRegistration.js
src/setupTests.js

src/reportWebVitals.ts
src/service-worker.ts
src/serviceWorkerRegistration.ts
src/setupTests.ts
**/src/context/abis/*
167 changes: 167 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"plugins": [
"perfectionist",
"unused-imports",
"prettier",
"react",
"@next/eslint-plugin-next"
],
"extends": [
"airbnb",
"airbnb/hooks",
"prettier",
"plugin:react/recommended",
"plugin:@next/next/recommended"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".css"]
}
}
},
"rules": {
"no-alert": 0,
"camelcase": 0,
"no-console": 0,
"no-unused-vars": [
"off",
{
"ignoreRestSiblings": true
}
],
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-restricted-exports": 0,
"react/no-children-prop": 0,
"consistent-return": 0,
"react/react-in-jsx-scope": 0,
"jsx-a11y/anchor-is-valid": 0,
"react/no-array-index-key": 0,
"no-promise-executor-return": 0,
"react/require-default-props": 0,
"react/jsx-props-no-spreading": 0,
"react/display-name": 0,
"import/prefer-default-export": 0,
"react/function-component-definition": 0,
"jsx-a11y/control-has-associated-label": 0,
"react/forbid-prop-types": 0,
"no-plusplus": 0,
"no-use-before-define": 0,
"react/jsx-no-useless-fragment": [
1,
{
"allowExpressions": true
}
],
"prefer-destructuring": [
1,
{
"object": true,
"array": false
}
],
"react/no-unstable-nested-components": [
1,
{
"allowAsProps": true
}
],
"react/jsx-no-duplicate-props": [
1,
{
"ignoreCase": false
}
],
// unused-imports
// https://www.npmjs.com/package/eslint-plugin-unused-imports
"unused-imports/no-unused-imports": 1,
"unused-imports/no-unused-vars": [
0,
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
// perfectionist
// https://eslint-plugin-perfectionist.azat.io/
"perfectionist/sort-named-imports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-named-exports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-exports": [
1,
{
"order": "asc",
"type": "line-length"
}
],
"perfectionist/sort-imports": [
1,
{
"order": "asc",
"type": "line-length",
"newlines-between": "always",
"groups": [
[
"builtin",
"external"
],
"custom-context",
"custom-services",
"custom-hooks",
"custom-utils",
"internal",
"custom-components",
"custom-sections",
"custom-styles",
[
"parent",
"sibling",
"index"
],
"object",
"unknown"
],
"custom-groups": {
"value": {
"custom-context": "src/context/**",
"custom-services": "src/services/**",
"custom-hooks": "src/hooks/**",
"custom-utils": "src/utils/**",
"custom-components": "src/components/**",
"custom-sections": "src/sections/**",
"custom-styles": "src/styles/**"
}
},
"internal-pattern": [
"src/**"
]
}
]
}
}
42 changes: 0 additions & 42 deletions .eslintrc.json

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/gcp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Deploy to Cloud Run

on:
push:
branches: [ main ]
branches: [ main, feature/version-auto ]

env:
PROJECT_ID: number-one-fan
Expand All @@ -25,7 +25,12 @@ jobs:

- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'


- name: Set NOF_VERSION in environment
id: env-nof-version
run: |
bash ./scripts/product_version.sh -v patch
- name: Build Docker Image
run: docker build -t ${{ env.IMAGE_NAME }}:latest .

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hardhat.config.ts
# misc
.DS_Store
*.pem
.todo.md

# debug
npm-debug.log*
Expand Down
11 changes: 7 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
node_modules
.next
yarn.lock
build/*
dist/*
public/*
**/out/*
**/.next/*
**/node_modules/*
package-lock.json
public
yarn.lock
.github
.vscode
**/src/context/abis/*
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ARG MAIL_SG_FROM
ARG NEXT_PUBLIC_STORAGE_URL_ALPHA
ARG NEXT_PUBLIC_STORAGE_URL_GAMMA
ARG NEXT_PUBLIC_ADMIN_ACCOUNTS
ARG NOF_VERSION


# env
Expand All @@ -52,6 +53,7 @@ ENV MAIL_SG_FROM $MAIL_SG_FROM
ENV NEXT_PUBLIC_STORAGE_URL_ALPHA $NEXT_PUBLIC_STORAGE_URL_ALPHA
ENV NEXT_PUBLIC_STORAGE_URL_GAMMA $NEXT_PUBLIC_STORAGE_URL_GAMMA
ENV NEXT_PUBLIC_ADMIN_ACCOUNTS $NEXT_PUBLIC_ADMIN_ACCOUNTS
ENV NOF_VERSION $NOF_VERSION


COPY --from=deps /app/node_modules ./node_modules
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Create a .env file running the command in terminal
touch .env
```

The environment variables bellow needs to be set in the .env file when project is running locally:
The environment variables bellow needs to be set in the .env:

```sh
SKIP_PREFLIGHT_CHECK=true
Expand All @@ -49,6 +49,10 @@ GAMMA_SERVICE_URL='https://gamma-microservice-7bteynlhua-uc.a.run.app'
GRAPH_URL='https://api.thegraph.com/subgraphs/name/tomasfrancizco/nof_polygon'
WALLET_CONNECT_PROJECT_ID={you project ID from walletconnect.com}
CHAIN_NODE_PROVIDER_URL='https://polygon-mumbai.g.alchemy.com/v2/YOUR_API_KEY'
NODE_PROVIDER_MUMBAI_URL='https://stylish-dawn-bush.bsc-testnet.quiknode.pro/{YOUR_NODE_PROVIDER_KEY}'
NODE_PROVIDER_BSC_TESTNET_URL='https://bsc-testnet.nodereal.io/v1/{YOUR_NODE_PROVIDER_KEY}'
NODE_PROVIDER_OPBNB_TESTNET='https://opbnb-testnet.nodereal.io/v1/{YOUR_NODE_PROVIDER_KEY}'
NOF_VERSION='v0.0.0'

# Client-side
NEXT_PUBLIC_APP_ENV='development'
Expand All @@ -63,18 +67,12 @@ NEXT_PUBLIC_NOF_GAMMA_CARDS_HARDHAT_CONTRACT_ADDRESS=''
NEXT_PUBLIC_NOF_GAMMA_PACKS_HARDHAT_CONTRACT_ADDRESS=''
NEXT_PUBLIC_NOF_GAMMA_OFFERS_HARDHAT_CONTRACT_ADDRESS=''
NEXT_PUBLIC_NOF_GAMMA_TICKETS_HARDHAT_CONTRACT_ADDRESS=''


```

The source code of the smart contracts is located at [https://github.com/P4-Games/NoF-Smart-Contracts](https://github.com/P4-Games/NoF-Smart-Contracts). If you want to run them locally (example: on a hardhat or ganache node), after compiling them locally, change the addresses in the .env and set these options to network:
The source code of the smart contracts is located at [https://github.com/P4-Games/NoF-Smart-Contracts](https://github.com/P4-Games/NoF-Smart-Contracts).

```sh
NEXT_PUBLIC_CHAIN_NAME='localhost'
NEXT_PUBLIC_CHAIN_ID='0x539'
NEXT_PUBLIC_CHAIN_CURRENCY='ETH'
NEXT_PUBLIC_CHAIN_RPC_URL='http://localhost:8545'
```

All the environment variables needed are in the [example_env](./example_env) file.

# Quick commands

Expand Down
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ steps:
- NEXT_PUBLIC_STORAGE_URL_ALPHA=${_NEXT_PUBLIC_STORAGE_URL_ALPHA}
- NEXT_PUBLIC_STORAGE_URL_GAMMA=${_NEXT_PUBLIC_STORAGE_URL_GAMMA}
- NEXT_PUBLIC_ADMIN_ACCOUNTS=${_NEXT_PUBLIC_ADMIN_ACCOUNTS}

- NOF_VERSION=${_NOF_VERSION}

# build the container images
- name: "gcr.io/cloud-builders/docker"
Expand Down Expand Up @@ -61,7 +61,7 @@ steps:
"--build-arg", "NEXT_PUBLIC_STORAGE_URL_ALPHA=${_NEXT_PUBLIC_STORAGE_URL_ALPHA}",
"--build-arg", "NEXT_PUBLIC_STORAGE_URL_GAMMA=${_NEXT_PUBLIC_STORAGE_URL_GAMMA}",
"--build-arg", "NEXT_PUBLIC_ADMIN_ACCOUNTS=${_NEXT_PUBLIC_ADMIN_ACCOUNTS}",

"--build-arg", "NOF_VERSION=${_NOF_VERSION}",
"."
]

Expand Down
1 change: 1 addition & 0 deletions example_env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ NEXT_PUBLIC_APP_ENV='development'
NEXT_PUBLIC_STORAGE_URL_ALPHA='https://storage.googleapis.com/nof-alpha'
NEXT_PUBLIC_STORAGE_URL_GAMMA='https://storage.googleapis.com/nof-gamma'
NEXT_PUBLIC_ADMIN_ACCOUNTS='0x...,0X....,0xfa3....' // accounts separated by a comma
NOF_VERSION='v0.1.219'

// Only por local environment to put contracts addresses from hardhat
NEXT_PUBLIC_NOF_DAI_CONTRACT_CURRENT_ADDRESS=''
Expand Down
Loading

0 comments on commit c445268

Please sign in to comment.