-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
21 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
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,3 @@ | ||
node_modules/* | ||
.yarn/* | ||
!.yarn/releases/*.cjs |
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 |
---|---|---|
@@ -1,30 +1,37 @@ | ||
# React + TypeScript + Vite | ||
# EUROe usage demo | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
This dapp exemplifies how to do age verification together with payment using | ||
EUROe, or any other CIS2, token. | ||
|
||
Currently, two official plugins are available: | ||
Note that only the **frontend** is here. This frontend does not verify age | ||
proofs, it just accepts them. In a real production scenario the proofs would of | ||
course be verified, linked to an account, and a session token generated to allow | ||
usage of the store for that session. | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
To develop use | ||
|
||
## Expanding the ESLint configuration | ||
``` | ||
yarn dev | ||
``` | ||
|
||
which will start a development server and print the address on which it is | ||
listening. Use `yarn fmt` and `yarn lint` before committing to ensure consistent | ||
formatting and adherence to common style. | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: | ||
To build for production run | ||
``` | ||
yarn build | ||
``` | ||
|
||
- Configure the top-level `parserOptions` property like this: | ||
which will produce the artifacts in the `dist` folder. | ||
|
||
```js | ||
export default { | ||
// other rules... | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
project: ['./tsconfig.json', './tsconfig.node.json'], | ||
tsconfigRootDir: __dirname, | ||
}, | ||
}; | ||
|
||
## Docker image | ||
|
||
To build a docker image run | ||
|
||
``` | ||
docker build -f scripts/Dockerfile . | ||
``` | ||
|
||
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` | ||
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked` | ||
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list | ||
from this directory (i.e., directory the README file is located in). |
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,12 @@ | ||
ARG build_image="node:20-slim" | ||
FROM ${build_image} AS build | ||
WORKDIR /app | ||
COPY package.json yarn.lock .yarnrc.yml ./ | ||
COPY .yarn/releases/*.cjs ./.yarn/releases/ | ||
RUN corepack yarn install | ||
COPY . . | ||
RUN corepack yarn build | ||
|
||
FROM nginx | ||
COPY --from=build ./app/dist ./usr/share/nginx/html | ||
COPY ./scripts/nginx.conf /etc/nginx/conf.d/default.conf |
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,42 @@ | ||
# Enable Gzip | ||
gzip on; | ||
gzip_http_version 1.0; | ||
gzip_comp_level 2; | ||
gzip_min_length 1100; | ||
gzip_buffers 4 8k; | ||
gzip_proxied any; | ||
gzip_types | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
text/x-component | ||
application/javascript | ||
application/json | ||
application/xml | ||
application/wasm | ||
application/rss+xml | ||
font/truetype | ||
font/opentype | ||
application/vnd.ms-fontobject | ||
image/svg+xml | ||
image/jpeg; | ||
|
||
gzip_static on; | ||
|
||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_disable "MSIE [1-6]\."; | ||
gzip_vary on; | ||
|
||
server { | ||
listen 80 default; | ||
server_name _; | ||
root /usr/share/nginx/html; | ||
|
||
# Set expires max on static file types | ||
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm|wasm)$ { | ||
expires max; | ||
root /usr/share/nginx/html; | ||
access_log off; | ||
} | ||
} |