From 1f9e7b423fd08813bbfdb8f102a3ee4e293d5dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sat, 1 May 2021 15:57:16 +0200 Subject: [PATCH 01/44] Split .gitignores --- .gitignore | 10 ---------- client/.gitignore | 1 + server/.gitignore | 7 +++++++ 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 .gitignore create mode 100644 server/.gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 1216ca4f..00000000 --- a/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.idea/ -node_modules/ -wiki -server/.env -.eslintcache -server/logs/ -server/files/ -server/files-test/ -uploads/ -tmp/ diff --git a/client/.gitignore b/client/.gitignore index f21726c7..2366fd52 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -22,3 +22,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +.eslintcache diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 00000000..028ac3fa --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,7 @@ +.eslintcache +.env +node_modules/ +logs/ +files/ +files-test/ +uploads/ From 46cb42b0576cec492e7c376b08a392f715171d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sat, 1 May 2021 15:59:15 +0200 Subject: [PATCH 02/44] Disabling version on about page (temporary) --- client/src/pages/About.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/pages/About.jsx b/client/src/pages/About.jsx index fddfccc1..4598014e 100644 --- a/client/src/pages/About.jsx +++ b/client/src/pages/About.jsx @@ -1,12 +1,12 @@ import React from "react"; -import GitInfo from "react-git-info/macro"; +// import GitInfo from "react-git-info/macro"; import variables from "../styles/base/_variables.module.scss"; const About = () => { - const gitInfo = GitInfo(); - const date = new Date(); - date.setTime(Date.parse(gitInfo.commit.date)); + // const gitInfo = GitInfo(); + // const date = new Date(); + // date.setTime(Date.parse(gitInfo.commit.date)); return (
{ - + {/* - + */}
Date de version : @@ -67,7 +67,7 @@ const About = () => { Hash de version : {gitInfo.commit.shortHash}
); From 597fc6d83498e0998ecffb3071b7db083b399fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sat, 1 May 2021 16:15:52 +0200 Subject: [PATCH 03/44] Dockerfiles for independant services --- client/.dockerignore | 1 + client/Dockerfile | 28 ++++++++++++++++++++++++++++ client/nginx.conf | 15 +++++++++++++++ server/.dockerignore | 7 +++++++ server/Dockerfile | 14 ++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 client/.dockerignore create mode 100644 client/Dockerfile create mode 100644 client/nginx.conf create mode 100644 server/.dockerignore create mode 100644 server/Dockerfile diff --git a/client/.dockerignore b/client/.dockerignore new file mode 100644 index 00000000..07e6e472 --- /dev/null +++ b/client/.dockerignore @@ -0,0 +1 @@ +/node_modules diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 00000000..60bbd410 --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,28 @@ +FROM node:14-alpine as builder + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install --only=production + +# Manually copying public and src to not copy nginx.conf +COPY public/ ./public/ +COPY src/ ./src/ + +RUN npm run build + +# ------------------------------------------------------ +# Production Build +# ------------------------------------------------------ +FROM nginx:1.16.0-alpine + +RUN rm /etc/nginx/conf.d/default.conf + +COPY nginx.conf /etc/nginx/conf.d + +COPY --from=builder /app/build /usr/share/nginx/html/ + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/client/nginx.conf b/client/nginx.conf new file mode 100644 index 00000000..e5c145b1 --- /dev/null +++ b/client/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + + location = /50x.html { + root /usr/share/nginx/html; + } +} diff --git a/server/.dockerignore b/server/.dockerignore new file mode 100644 index 00000000..028ac3fa --- /dev/null +++ b/server/.dockerignore @@ -0,0 +1,7 @@ +.eslintcache +.env +node_modules/ +logs/ +files/ +files-test/ +uploads/ diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 00000000..eb862840 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14 + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install --only=production + +COPY . . + +ENV PORT 5035 +EXPOSE 5035 + +CMD ["npm", "start"] From f349a34fce0f9c62a846a3ba85ea61deac630698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sat, 1 May 2021 17:48:05 +0200 Subject: [PATCH 04/44] Add docker-compose to orchestrate all of these! --- client/Dockerfile | 2 +- client/nginx-react.conf | 16 +++++++++++ client/nginx.conf | 15 ---------- docker-compose.yml | 63 +++++++++++++++++++++++++++++++++++++++++ nginx.conf | 12 ++++++++ server/Dockerfile | 5 ++-- 6 files changed, 95 insertions(+), 18 deletions(-) create mode 100644 client/nginx-react.conf delete mode 100644 client/nginx.conf create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/client/Dockerfile b/client/Dockerfile index 60bbd410..e4c24a1f 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -19,7 +19,7 @@ FROM nginx:1.16.0-alpine RUN rm /etc/nginx/conf.d/default.conf -COPY nginx.conf /etc/nginx/conf.d +COPY nginx-react.conf /etc/nginx/conf.d COPY --from=builder /app/build /usr/share/nginx/html/ diff --git a/client/nginx-react.conf b/client/nginx-react.conf new file mode 100644 index 00000000..d70b246a --- /dev/null +++ b/client/nginx-react.conf @@ -0,0 +1,16 @@ +server { + listen 80; + + root /usr/share/nginx/html; + + location / { + index index.html; + try_files $uri /index.html =404; + add_header Cache-Control "no-store, no-cache, must-revalidate"; + } + + location /static { + expires 1y; + add_header Cache-Control "public"; + } +} diff --git a/client/nginx.conf b/client/nginx.conf deleted file mode 100644 index e5c145b1..00000000 --- a/client/nginx.conf +++ /dev/null @@ -1,15 +0,0 @@ -server { - listen 80; - - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } - - error_page 500 502 503 504 /50x.html; - - location = /50x.html { - root /usr/share/nginx/html; - } -} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..226db6a9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,63 @@ +version: "3" + +services: + mariadb_db: + image: mariadb:10.6 + container_name: apothiquiz_db + volumes: + - apothiquiz_data:/var/lib/mysql/ + networks: + - apothiquiz_network + expose: + - "3306" + environment: + MYSQL_ROOT_PASSWORD: "aaaaa" + MYSQL_DATABASE: apothiquizDb + MYSQL_USER: apothiquizUser + MYSQL_PASSWORD: __YOUR_PASSWORD_HERE__ + + server: + image: valfranath/apothiquiz-server + depends_on: + - mariadb_db + container_name: apothiquiz_server + command: npm start + networks: + - apothiquiz_network + environment: + NODE_ENV: test + PORT: 80 + ACCESS_TOKEN_KEY: __ACCESS_TMP__ + REFRESH_TOKEN_KEY: __REFRESH_TMP__ + DB_HOST: apothiquiz_db + DB_USER: apothiquizUser + DB_PASSWORD: __YOUR_PASSWORD_HERE__ + DB_DATABASE: apothiquizDb + DB_DATABASE_TEST: apothiquizDb + + client: + image: valfranath/apothiquiz-client + container_name: apothiquiz_client + networks: + - apothiquiz_network + + proxy: + image: nginx:1.16.0-alpine + depends_on: + - server + - client + container_name: apothiquiz_proxy + volumes: + - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf + ports: + - 61100:80 + + networks: + - apothiquiz_network + +volumes: + apothiquiz_data: + +networks: + apothiquiz_network: + driver: bridge diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..2cbe0b57 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,12 @@ +server { + charset utf-8; + client_max_body_size 50M; + + location / { + proxy_pass http://client; + } + + location /api/ { + proxy_pass http://server/api/; + } +} diff --git a/server/Dockerfile b/server/Dockerfile index eb862840..d9d73d52 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14 +FROM node:14-alpine WORKDIR /app @@ -9,6 +9,7 @@ RUN npm install --only=production COPY . . ENV PORT 5035 + EXPOSE 5035 -CMD ["npm", "start"] +CMD ["node", "index.js"] From b22ca87caf7abbf6cc2b967881cd89c49ff695fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sat, 1 May 2021 18:03:10 +0200 Subject: [PATCH 05/44] Better configurations --- docker-compose.yml | 11 ++++++++--- nginx.conf | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 226db6a9..dab1f9f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: mariadb_db: image: mariadb:10.6 container_name: apothiquiz_db + restart: unless-stopped volumes: - apothiquiz_data:/var/lib/mysql/ networks: @@ -18,10 +19,11 @@ services: server: image: valfranath/apothiquiz-server + build: server/ depends_on: - mariadb_db container_name: apothiquiz_server - command: npm start + restart: unless-stopped networks: - apothiquiz_network environment: @@ -37,7 +39,9 @@ services: client: image: valfranath/apothiquiz-client + build: client/ container_name: apothiquiz_client + restart: unless-stopped networks: - apothiquiz_network @@ -46,9 +50,10 @@ services: depends_on: - server - client - container_name: apothiquiz_proxy + container_name: apothiquiz_proxy + restart: unless-stopped volumes: - - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf + - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro ports: - 61100:80 diff --git a/nginx.conf b/nginx.conf index 2cbe0b57..51c68d79 100644 --- a/nginx.conf +++ b/nginx.conf @@ -7,6 +7,13 @@ server { } location /api/ { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_next_upstream error timeout http_502 http_503 http_504; + proxy_pass http://server/api/; } } From 6d4e2f0f1dc2c68f550427fc58614903abe4be56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 00:12:30 +0200 Subject: [PATCH 06/44] Show version in client --- client/Dockerfile | 2 ++ client/package-lock.json | 18 ++++++++++++++++++ client/package.json | 1 + client/src/pages/About.jsx | 26 ++++++++++---------------- client/src/styles/pages/_About.scss | 20 +++++++++++++++----- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/client/Dockerfile b/client/Dockerfile index e4c24a1f..2ae03cd5 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -10,6 +10,8 @@ RUN npm install --only=production COPY public/ ./public/ COPY src/ ./src/ +ARG REACT_APP_VERSION="development" + RUN npm run build # ------------------------------------------------------ diff --git a/client/package-lock.json b/client/package-lock.json index 6a6bf938..239c7faa 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -4051,6 +4051,16 @@ "@babel/helper-define-polyfill-provider": "^0.1.5" } }, + "babel-plugin-preval": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-preval/-/babel-plugin-preval-5.0.0.tgz", + "integrity": "sha512-8DqJq6/LPUjSZ0Qq6bVIFpsj2flCEE0Cbnbut9TvGU6jP9g3dOWEXtQ/sdvsA9d6souza8eNGh04WRXpuH9ThA==", + "requires": { + "@babel/runtime": "^7.9.2", + "babel-plugin-macros": "^2.8.0", + "require-from-string": "^2.0.2" + } + }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", @@ -15405,6 +15415,14 @@ "react-is": "^16.8.4" } }, + "preval.macro": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/preval.macro/-/preval.macro-5.0.0.tgz", + "integrity": "sha512-+OZRqZYx1pjZ7H5Jis8bPFXkiT7lwA46UzAT4IjuzFVKwkJK+TwIx1TCqrqNCf8U3e5O12mEJEz1BXslkCLWfQ==", + "requires": { + "babel-plugin-preval": "^5.0.0" + } + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", diff --git a/client/package.json b/client/package.json index 20a84fed..e1186c12 100644 --- a/client/package.json +++ b/client/package.json @@ -17,6 +17,7 @@ "find-config": "^1.0.0", "node-sass": "^4.14.1", "path": "^0.12.7", + "preval.macro": "^5.0.0", "prop-types": "^15.7.2", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/client/src/pages/About.jsx b/client/src/pages/About.jsx index 4598014e..73189fee 100644 --- a/client/src/pages/About.jsx +++ b/client/src/pages/About.jsx @@ -1,12 +1,10 @@ +import preval from "preval.macro"; import React from "react"; -// import GitInfo from "react-git-info/macro"; import variables from "../styles/base/_variables.module.scss"; const About = () => { - // const gitInfo = GitInfo(); - // const date = new Date(); - // date.setTime(Date.parse(gitInfo.commit.date)); + const dateTimeStamp = preval`module.exports = new Date().toLocaleString();`; return (
{ - {/* + + + + + {process.env.NODE_ENV !== "development" && ( - - + + - - - - - */} + )}
Version : {process.env.REACT_APP_VERSION ?? "developement"}
Date de version : - {process.env.NODE_ENV === "production" - ? date.toLocaleString().split("GMT")[0] - : process.env.NODE_ENV} - Date de compilation : {dateTimeStamp}
Hash de version : {gitInfo.commit.shortHash}
); diff --git a/client/src/styles/pages/_About.scss b/client/src/styles/pages/_About.scss index 84849e31..6ab82e3f 100644 --- a/client/src/styles/pages/_About.scss +++ b/client/src/styles/pages/_About.scss @@ -12,9 +12,10 @@ main#informations { margin: 1rem auto; } - #credits, - #app-version { - margin: 0.5rem auto; + #credits { + margin: 0.5rem; + margin-top: auto; + font-size: 0.9rem; li { @@ -26,7 +27,16 @@ main#informations { } } - #credits { - margin-top: auto; + #app-version { + margin: 0.5rem auto; + font-size: 0.9rem; + + td:first-of-type { + text-align: right; + } + td:last-of-type { + text-align: left; + padding-left: 0.5ch; + } } } From fec15616bbf254726d855d67661b0c2602c44923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 01:26:05 +0200 Subject: [PATCH 07/44] Dev dockerfiles in progress: no volumes and networking is not on point --- client/dev.Dockerfile | 11 ++++++ client/package-lock.json | 8 ----- client/package.json | 1 - docker-compose.dev.yml | 73 ++++++++++++++++++++++++++++++++++++++++ server/dev.Dockerfile | 15 +++++++++ server/package-lock.json | 18 +++++----- 6 files changed, 109 insertions(+), 17 deletions(-) create mode 100644 client/dev.Dockerfile create mode 100644 docker-compose.dev.yml create mode 100644 server/dev.Dockerfile diff --git a/client/dev.Dockerfile b/client/dev.Dockerfile new file mode 100644 index 00000000..a6cef808 --- /dev/null +++ b/client/dev.Dockerfile @@ -0,0 +1,11 @@ +FROM node:14-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +CMD ["npm", "run", "start"] diff --git a/client/package-lock.json b/client/package-lock.json index 239c7faa..f86d8e57 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -15851,14 +15851,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "react-git-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/react-git-info/-/react-git-info-2.0.0.tgz", - "integrity": "sha512-+PAtJryaKH256xnLNaFg2/YDso6z+OTh93G5Z22tHgyjDazwkjk30TLRwdqUV4LEal2bBmRIKcpATgWg7sBvoA==", - "requires": { - "babel-plugin-macros": "^2.8.0" - } - }, "react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/client/package.json b/client/package.json index e1186c12..cb1b10bb 100644 --- a/client/package.json +++ b/client/package.json @@ -21,7 +21,6 @@ "prop-types": "^15.7.2", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-git-info": "^2.0.0", "react-query": "^3.8.2", "react-router-dom": "^5.2.0", "react-scripts": "^4.0.1", diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 00000000..95d26fc2 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,73 @@ +version: "3" + +services: + mariadb_db: + image: mariadb:10.6 + volumes: + - apothiquiz_dev_data:/var/lib/mysql/ + networks: + - apothiquiz_dev_network + expose: + - "3306" + environment: + MYSQL_ROOT_PASSWORD: "aaaaa" + MYSQL_DATABASE: apothiquizDb + MYSQL_USER: apothiquizUser + MYSQL_PASSWORD: apothiquizPassword + + server: + build: + context: server/ + dockerfile: dev.Dockerfile + container_name: apothiquiz_dev_server + depends_on: + - mariadb_db + # volumes: + # - "./server:/app" + networks: + - apothiquiz_dev_network + environment: + NODE_ENV: test + PORT: 80 + ACCESS_TOKEN_KEY: __ACCESS_TMP__ + REFRESH_TOKEN_KEY: __REFRESH_TMP__ + DB_HOST: mariadb_db + DB_USER: apothiquizUser + DB_PASSWORD: apothiquizPassword + DB_DATABASE: apothiquizDb + DB_DATABASE_TEST: apothiquizDb + + client: + build: + context: client/ + dockerfile: dev.Dockerfile + container_name: apothiquiz_dev_client + environment: + PORT: 80 + HOST: client + # volumes: + # - "./client/:/app/" + networks: + - apothiquiz_dev_network + + proxy: + image: nginx:1.16.0-alpine + depends_on: + - server + - client + container_name: apothiquiz_proxy + restart: unless-stopped + volumes: + - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro + ports: + - 3000:80 + + networks: + - apothiquiz_dev_network + +volumes: + apothiquiz_dev_data: + +networks: + apothiquiz_dev_network: + driver: bridge diff --git a/server/dev.Dockerfile b/server/dev.Dockerfile new file mode 100644 index 00000000..91cb9556 --- /dev/null +++ b/server/dev.Dockerfile @@ -0,0 +1,15 @@ +FROM node:14-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +ENV PORT 5035 + +EXPOSE 5035 + +CMD ["node", "index.js"] diff --git a/server/package-lock.json b/server/package-lock.json index 3ad45e6f..d29f1100 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -3195,6 +3195,16 @@ "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" + }, + "dependencies": { + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } } }, "readdirp": { @@ -3590,14 +3600,6 @@ "define-properties": "^1.1.3" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", From 38f0d1d14c545369f8a2042f6bf1fc4eef6363ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 12:36:15 +0200 Subject: [PATCH 08/44] Docker-compose for dev-environement --- client/dev.Dockerfile | 11 --------- client/package.json | 2 +- client/src/pages/About.jsx | 2 +- docker-compose.dev.yml | 46 ++++++++++++++------------------------ server/dev.Dockerfile | 15 ------------- 5 files changed, 19 insertions(+), 57 deletions(-) delete mode 100644 client/dev.Dockerfile delete mode 100644 server/dev.Dockerfile diff --git a/client/dev.Dockerfile b/client/dev.Dockerfile deleted file mode 100644 index a6cef808..00000000 --- a/client/dev.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:14-alpine - -WORKDIR /app - -COPY package*.json ./ - -RUN npm install - -COPY . . - -CMD ["npm", "run", "start"] diff --git a/client/package.json b/client/package.json index cb1b10bb..00a34e9a 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "client", "version": "0.1.0", - "proxy": "http://localhost:5035", + "proxy": "http://server:5035", "private": true, "dependencies": { "@modulz/radix-icons": "^3.2.0", diff --git a/client/src/pages/About.jsx b/client/src/pages/About.jsx index 73189fee..5dbb951a 100644 --- a/client/src/pages/About.jsx +++ b/client/src/pages/About.jsx @@ -54,7 +54,7 @@ const About = () => { - + {process.env.NODE_ENV !== "development" && ( diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 95d26fc2..b4152db8 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -16,52 +16,40 @@ services: MYSQL_PASSWORD: apothiquizPassword server: - build: - context: server/ - dockerfile: dev.Dockerfile + image: node:14 container_name: apothiquiz_dev_server depends_on: - mariadb_db - # volumes: - # - "./server:/app" + volumes: + - "./server:/app" networks: - apothiquiz_dev_network + working_dir: /app + command: ["npm", "run", "start:watch"] + ports: + - 5035:5035 environment: - NODE_ENV: test - PORT: 80 + NODE_ENV: development + PORT: 5035 ACCESS_TOKEN_KEY: __ACCESS_TMP__ REFRESH_TOKEN_KEY: __REFRESH_TMP__ DB_HOST: mariadb_db DB_USER: apothiquizUser - DB_PASSWORD: apothiquizPassword DB_DATABASE: apothiquizDb - DB_DATABASE_TEST: apothiquizDb + DB_PASSWORD: apothiquizPassword client: - build: - context: client/ - dockerfile: dev.Dockerfile + image: node:14 container_name: apothiquiz_dev_client environment: - PORT: 80 + PORT: 3000 HOST: client - # volumes: - # - "./client/:/app/" - networks: - - apothiquiz_dev_network - - proxy: - image: nginx:1.16.0-alpine - depends_on: - - server - - client - container_name: apothiquiz_proxy - restart: unless-stopped - volumes: - - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro ports: - - 3000:80 - + - 3000:3000 + volumes: + - "./client/:/app/" + working_dir: /app + command: ["npm", "start"] networks: - apothiquiz_dev_network diff --git a/server/dev.Dockerfile b/server/dev.Dockerfile deleted file mode 100644 index 91cb9556..00000000 --- a/server/dev.Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:14-alpine - -WORKDIR /app - -COPY package*.json ./ - -RUN npm install - -COPY . . - -ENV PORT 5035 - -EXPOSE 5035 - -CMD ["node", "index.js"] From 76af23d50f1ecf92fa4dfd85bfae86dad16518f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 12:38:23 +0200 Subject: [PATCH 09/44] Invert docker-compose dev and prod --- docker-compose.dev.yml | 61 ------------------------------------ docker-compose.prod.yml | 68 +++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 65 ++++++++++++++++++--------------------- 3 files changed, 97 insertions(+), 97 deletions(-) delete mode 100644 docker-compose.dev.yml create mode 100644 docker-compose.prod.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml deleted file mode 100644 index b4152db8..00000000 --- a/docker-compose.dev.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: "3" - -services: - mariadb_db: - image: mariadb:10.6 - volumes: - - apothiquiz_dev_data:/var/lib/mysql/ - networks: - - apothiquiz_dev_network - expose: - - "3306" - environment: - MYSQL_ROOT_PASSWORD: "aaaaa" - MYSQL_DATABASE: apothiquizDb - MYSQL_USER: apothiquizUser - MYSQL_PASSWORD: apothiquizPassword - - server: - image: node:14 - container_name: apothiquiz_dev_server - depends_on: - - mariadb_db - volumes: - - "./server:/app" - networks: - - apothiquiz_dev_network - working_dir: /app - command: ["npm", "run", "start:watch"] - ports: - - 5035:5035 - environment: - NODE_ENV: development - PORT: 5035 - ACCESS_TOKEN_KEY: __ACCESS_TMP__ - REFRESH_TOKEN_KEY: __REFRESH_TMP__ - DB_HOST: mariadb_db - DB_USER: apothiquizUser - DB_DATABASE: apothiquizDb - DB_PASSWORD: apothiquizPassword - - client: - image: node:14 - container_name: apothiquiz_dev_client - environment: - PORT: 3000 - HOST: client - ports: - - 3000:3000 - volumes: - - "./client/:/app/" - working_dir: /app - command: ["npm", "start"] - networks: - - apothiquiz_dev_network - -volumes: - apothiquiz_dev_data: - -networks: - apothiquiz_dev_network: - driver: bridge diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 00000000..dab1f9f4 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,68 @@ +version: "3" + +services: + mariadb_db: + image: mariadb:10.6 + container_name: apothiquiz_db + restart: unless-stopped + volumes: + - apothiquiz_data:/var/lib/mysql/ + networks: + - apothiquiz_network + expose: + - "3306" + environment: + MYSQL_ROOT_PASSWORD: "aaaaa" + MYSQL_DATABASE: apothiquizDb + MYSQL_USER: apothiquizUser + MYSQL_PASSWORD: __YOUR_PASSWORD_HERE__ + + server: + image: valfranath/apothiquiz-server + build: server/ + depends_on: + - mariadb_db + container_name: apothiquiz_server + restart: unless-stopped + networks: + - apothiquiz_network + environment: + NODE_ENV: test + PORT: 80 + ACCESS_TOKEN_KEY: __ACCESS_TMP__ + REFRESH_TOKEN_KEY: __REFRESH_TMP__ + DB_HOST: apothiquiz_db + DB_USER: apothiquizUser + DB_PASSWORD: __YOUR_PASSWORD_HERE__ + DB_DATABASE: apothiquizDb + DB_DATABASE_TEST: apothiquizDb + + client: + image: valfranath/apothiquiz-client + build: client/ + container_name: apothiquiz_client + restart: unless-stopped + networks: + - apothiquiz_network + + proxy: + image: nginx:1.16.0-alpine + depends_on: + - server + - client + container_name: apothiquiz_proxy + restart: unless-stopped + volumes: + - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro + ports: + - 61100:80 + + networks: + - apothiquiz_network + +volumes: + apothiquiz_data: + +networks: + apothiquiz_network: + driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml index dab1f9f4..b4152db8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,66 +3,59 @@ version: "3" services: mariadb_db: image: mariadb:10.6 - container_name: apothiquiz_db - restart: unless-stopped volumes: - - apothiquiz_data:/var/lib/mysql/ + - apothiquiz_dev_data:/var/lib/mysql/ networks: - - apothiquiz_network + - apothiquiz_dev_network expose: - "3306" environment: MYSQL_ROOT_PASSWORD: "aaaaa" MYSQL_DATABASE: apothiquizDb MYSQL_USER: apothiquizUser - MYSQL_PASSWORD: __YOUR_PASSWORD_HERE__ + MYSQL_PASSWORD: apothiquizPassword server: - image: valfranath/apothiquiz-server - build: server/ + image: node:14 + container_name: apothiquiz_dev_server depends_on: - mariadb_db - container_name: apothiquiz_server - restart: unless-stopped + volumes: + - "./server:/app" networks: - - apothiquiz_network + - apothiquiz_dev_network + working_dir: /app + command: ["npm", "run", "start:watch"] + ports: + - 5035:5035 environment: - NODE_ENV: test - PORT: 80 + NODE_ENV: development + PORT: 5035 ACCESS_TOKEN_KEY: __ACCESS_TMP__ REFRESH_TOKEN_KEY: __REFRESH_TMP__ - DB_HOST: apothiquiz_db + DB_HOST: mariadb_db DB_USER: apothiquizUser - DB_PASSWORD: __YOUR_PASSWORD_HERE__ DB_DATABASE: apothiquizDb - DB_DATABASE_TEST: apothiquizDb + DB_PASSWORD: apothiquizPassword client: - image: valfranath/apothiquiz-client - build: client/ - container_name: apothiquiz_client - restart: unless-stopped - networks: - - apothiquiz_network - - proxy: - image: nginx:1.16.0-alpine - depends_on: - - server - - client - container_name: apothiquiz_proxy - restart: unless-stopped - volumes: - - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro + image: node:14 + container_name: apothiquiz_dev_client + environment: + PORT: 3000 + HOST: client ports: - - 61100:80 - + - 3000:3000 + volumes: + - "./client/:/app/" + working_dir: /app + command: ["npm", "start"] networks: - - apothiquiz_network + - apothiquiz_dev_network volumes: - apothiquiz_data: + apothiquiz_dev_data: networks: - apothiquiz_network: + apothiquiz_dev_network: driver: bridge From a4a1add12a5b6c129fa707c446d66d3ce7f25776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 12:58:32 +0200 Subject: [PATCH 10/44] Yay container really depends on --- docker-compose.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b4152db8..babcfc9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,16 +10,19 @@ services: expose: - "3306" environment: - MYSQL_ROOT_PASSWORD: "aaaaa" + MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: apothiquizDb MYSQL_USER: apothiquizUser MYSQL_PASSWORD: apothiquizPassword + healthcheck: + test: "exit 0" server: image: node:14 container_name: apothiquiz_dev_server depends_on: - - mariadb_db + mariadb_db: + condition: service_healthy volumes: - "./server:/app" networks: From cb2bc68b5395dabde62a9383a4358adb12632890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 2 May 2021 16:59:11 +0200 Subject: [PATCH 11/44] Actually, it's 2.4 to have condition: service_healthy --- docker-compose.prod.yml | 12 +++++++----- docker-compose.yml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index dab1f9f4..9ded9f9a 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,4 +1,4 @@ -version: "3" +version: "2.4" services: mariadb_db: @@ -12,22 +12,25 @@ services: expose: - "3306" environment: - MYSQL_ROOT_PASSWORD: "aaaaa" + MYSQL_ROOT_PASSWORD: __YOUR_PASSWORD_HERE__ MYSQL_DATABASE: apothiquizDb MYSQL_USER: apothiquizUser MYSQL_PASSWORD: __YOUR_PASSWORD_HERE__ + healthcheck: + test: "exit 0" server: image: valfranath/apothiquiz-server build: server/ depends_on: - - mariadb_db + mariadb_db: + condition: service_healthy + container_name: apothiquiz_server restart: unless-stopped networks: - apothiquiz_network environment: - NODE_ENV: test PORT: 80 ACCESS_TOKEN_KEY: __ACCESS_TMP__ REFRESH_TOKEN_KEY: __REFRESH_TMP__ @@ -35,7 +38,6 @@ services: DB_USER: apothiquizUser DB_PASSWORD: __YOUR_PASSWORD_HERE__ DB_DATABASE: apothiquizDb - DB_DATABASE_TEST: apothiquizDb client: image: valfranath/apothiquiz-client diff --git a/docker-compose.yml b/docker-compose.yml index babcfc9a..2845ee9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: "2.4" services: mariadb_db: From 2300a5af271d24336ffca3d16894bd7967715790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Thu, 15 Jul 2021 16:59:30 +0200 Subject: [PATCH 12/44] Use rootfs folders --- client/Dockerfile | 9 ++++----- client/{ => rootfs/etc/nginx/conf.d}/nginx-react.conf | 0 docker-compose.prod.yml | 2 +- nginx.conf => rootfs/etc/nginx/nginx.conf | 0 4 files changed, 5 insertions(+), 6 deletions(-) rename client/{ => rootfs/etc/nginx/conf.d}/nginx-react.conf (100%) rename nginx.conf => rootfs/etc/nginx/nginx.conf (100%) diff --git a/client/Dockerfile b/client/Dockerfile index 2ae03cd5..fb67707f 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,17 +1,16 @@ FROM node:14-alpine as builder +ARG REACT_APP_VERSION="development" + WORKDIR /app COPY package*.json ./ - RUN npm install --only=production -# Manually copying public and src to not copy nginx.conf +# Manually copying public and src to not copy rootfs/ COPY public/ ./public/ COPY src/ ./src/ -ARG REACT_APP_VERSION="development" - RUN npm run build # ------------------------------------------------------ @@ -21,7 +20,7 @@ FROM nginx:1.16.0-alpine RUN rm /etc/nginx/conf.d/default.conf -COPY nginx-react.conf /etc/nginx/conf.d +COPY rootfs/ / COPY --from=builder /app/build /usr/share/nginx/html/ diff --git a/client/nginx-react.conf b/client/rootfs/etc/nginx/conf.d/nginx-react.conf similarity index 100% rename from client/nginx-react.conf rename to client/rootfs/etc/nginx/conf.d/nginx-react.conf diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 9ded9f9a..8a3d5343 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -55,7 +55,7 @@ services: container_name: apothiquiz_proxy restart: unless-stopped volumes: - - $PWD/nginx.conf:/etc/nginx/conf.d/default.conf:ro + - $PWD/rootfs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro ports: - 61100:80 diff --git a/nginx.conf b/rootfs/etc/nginx/nginx.conf similarity index 100% rename from nginx.conf rename to rootfs/etc/nginx/nginx.conf From 1ef8a77170bcc36ee3aeb9864d7e26fa951f54d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Thu, 15 Jul 2021 18:22:59 +0200 Subject: [PATCH 13/44] Add LDAP informations to production dockerfile --- docker-compose.prod.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 8a3d5343..6b376ccb 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -38,6 +38,8 @@ services: DB_USER: apothiquizUser DB_PASSWORD: __YOUR_PASSWORD_HERE__ DB_DATABASE: apothiquizDb + LDAP_URL: 'ldap://ldap.univ-fcomte.fr' + LDAP_DOMAIN: 'ou=people,dc=univ-fcomte,dc=fr' client: image: valfranath/apothiquiz-client From c3534af376c6f90f937ae54be15080781aebad3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Thu, 15 Jul 2021 18:40:53 +0200 Subject: [PATCH 14/44] Added npm install to dockerfile in dev environment --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2845ee9a..de80da77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: networks: - apothiquiz_dev_network working_dir: /app - command: ["npm", "run", "start:watch"] + command: ["npm", "install", ";", npm", "run", "start:watch"] ports: - 5035:5035 environment: @@ -52,7 +52,7 @@ services: volumes: - "./client/:/app/" working_dir: /app - command: ["npm", "start"] + command: ["npm", "install", ";", "npm", "start"] networks: - apothiquiz_dev_network From 1555b48a6a4eed582fbb5340d4086ec3c1b61fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Thu, 15 Jul 2021 20:18:27 +0200 Subject: [PATCH 15/44] Add npm management to dev dockerfiles --- client/dev.Dockerfile | 9 ++++++ docker-compose.yml | 54 +++++++++++++++++++--------------- githooks/post-merge.sh | 4 +-- githooks/pre-commit.sh | 8 ++--- server/controllers/question.js | 2 ++ server/dev.Dockerfile | 9 ++++++ 6 files changed, 56 insertions(+), 30 deletions(-) create mode 100644 client/dev.Dockerfile create mode 100644 server/dev.Dockerfile diff --git a/client/dev.Dockerfile b/client/dev.Dockerfile new file mode 100644 index 00000000..7df19450 --- /dev/null +++ b/client/dev.Dockerfile @@ -0,0 +1,9 @@ +FROM node:14-alpine + +WORKDIR /usr/app + +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index de80da77..3f0bef7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,11 @@ version: "2.4" services: mariadb_db: image: mariadb:10.6 + command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci volumes: - - apothiquiz_dev_data:/var/lib/mysql/ + - dev_data:/var/lib/mysql/ networks: - - apothiquiz_dev_network + - dev_network expose: - "3306" environment: @@ -16,21 +17,22 @@ services: MYSQL_PASSWORD: apothiquizPassword healthcheck: test: "exit 0" - + server: - image: node:14 - container_name: apothiquiz_dev_server - depends_on: - mariadb_db: - condition: service_healthy + build: + context: ./server/ + dockerfile: dev.Dockerfile + command: npm run start:watch volumes: - - "./server:/app" - networks: - - apothiquiz_dev_network - working_dir: /app - command: ["npm", "install", ";", npm", "run", "start:watch"] + - ./server:/usr/app/ + - /usr/app/node_modules ports: - 5035:5035 + networks: + - dev_network + depends_on: + mariadb_db: + condition: service_healthy environment: NODE_ENV: development PORT: 5035 @@ -39,26 +41,30 @@ services: DB_HOST: mariadb_db DB_USER: apothiquizUser DB_DATABASE: apothiquizDb + DB_DATABASE_TEST: apothiquizDb DB_PASSWORD: apothiquizPassword + LDAP_URL: __LDAP_URL__ + LDAP_DOMAIN: __LDAP_DOMAIN__ client: - image: node:14 - container_name: apothiquiz_dev_client - environment: - PORT: 3000 - HOST: client + build: + context: ./client/ + dockerfile: dev.Dockerfile + command: npm start ports: - 3000:3000 volumes: - - "./client/:/app/" - working_dir: /app - command: ["npm", "install", ";", "npm", "start"] + - ./client/:/usr/app/ + - /usr/app/node_modules networks: - - apothiquiz_dev_network + - dev_network + environment: + PORT: 3000 + HOST: client volumes: - apothiquiz_dev_data: + dev_data: networks: - apothiquiz_dev_network: + dev_network: driver: bridge diff --git a/githooks/post-merge.sh b/githooks/post-merge.sh index 8e3be5b8..bbd25ab6 100755 --- a/githooks/post-merge.sh +++ b/githooks/post-merge.sh @@ -7,13 +7,13 @@ function changed() { cd "$(git rev-parse --show-toplevel)/server" || exit 1 if changed 'server/package-lock.json'; then echo "📦 server/package-lock.json changed. Running npm install" - npm install || exit 1 + docker-compose exec -T server npm install || exit 1 fi cd "$(git rev-parse --show-toplevel)/client" || exit 1 if changed 'client/package-lock.json'; then echo "📦 client/package-lock.json changed. Running npm install" - npm install || exit 1 + docker-compose exec -T client npm install || exit 1 fi exit 0 diff --git a/githooks/pre-commit.sh b/githooks/pre-commit.sh index af306dfb..1a073736 100755 --- a/githooks/pre-commit.sh +++ b/githooks/pre-commit.sh @@ -3,15 +3,15 @@ if [ "$(git diff --name-only HEAD | grep "^server/")" != "" ]; then cd "$(git rev-parse --show-toplevel)/server" || exit 1 echo "Linting and formatting server files" - npm run format:write || exit 1 - npm run lint:fix -- --max-warnings 0 || exit 1 + docker-compose exec -T server npm run format:write || exit 1 + docker-compose exec -T server npm run lint:fix -- --max-warnings 0 || exit 1 fi if [ "$(git diff --name-only HEAD | grep "^client/")" != "" ]; then cd "$(git rev-parse --show-toplevel)/client" || exit 1 echo "Linting and formatting client files" - npm run format:write || exit 1 - npm run lint:fix -- --max-warnings 0 || exit 1 + docker-compose exec -T client npm run format:write || exit 1 + docker-compose exec -T client npm run lint:fix -- --max-warnings 0 || exit 1 fi cd "$(git rev-parse --show-toplevel)" || exit 1 diff --git a/server/controllers/question.js b/server/controllers/question.js index 20071244..270d8090 100644 --- a/server/controllers/question.js +++ b/server/controllers/question.js @@ -233,6 +233,8 @@ function formatQuestion(data) { const answers = badAnswers.slice(); answers.splice(randomIndex, 0, goodAnswer); + console.debug(answers); + return { subject: data[0].subject, goodAnswer: randomIndex, diff --git a/server/dev.Dockerfile b/server/dev.Dockerfile new file mode 100644 index 00000000..7df19450 --- /dev/null +++ b/server/dev.Dockerfile @@ -0,0 +1,9 @@ +FROM node:14-alpine + +WORKDIR /usr/app + +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . . From 120f19c3d52c209396d9259a552c77a442bcaa65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 13:47:19 +0100 Subject: [PATCH 16/44] =?UTF-8?q?random:=20Je=20sais=20plus=20o=C3=B9=20j'?= =?UTF-8?q?en=20=C3=A9tais=20et=20je=20commit=20ici?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/dev.Dockerfile | 3 +-- docker-compose.yml | 13 ++++++------- server/dev.Dockerfile | 4 +--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/client/dev.Dockerfile b/client/dev.Dockerfile index 7df19450..f1a71392 100644 --- a/client/dev.Dockerfile +++ b/client/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-alpine +FROM node:16 WORKDIR /usr/app @@ -6,4 +6,3 @@ COPY package.json package-lock.json ./ RUN npm install -COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index 3f0bef7c..5405f646 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,10 @@ version: "2.4" services: - mariadb_db: + mariadb: image: mariadb:10.6 - command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci volumes: - - dev_data:/var/lib/mysql/ + - dev_database:/var/lib/mysql/ networks: - dev_network expose: @@ -17,7 +16,7 @@ services: MYSQL_PASSWORD: apothiquizPassword healthcheck: test: "exit 0" - + server: build: context: ./server/ @@ -31,14 +30,14 @@ services: networks: - dev_network depends_on: - mariadb_db: + mariadb: condition: service_healthy environment: NODE_ENV: development PORT: 5035 ACCESS_TOKEN_KEY: __ACCESS_TMP__ REFRESH_TOKEN_KEY: __REFRESH_TMP__ - DB_HOST: mariadb_db + DB_HOST: mariadb DB_USER: apothiquizUser DB_DATABASE: apothiquizDb DB_DATABASE_TEST: apothiquizDb @@ -63,7 +62,7 @@ services: HOST: client volumes: - dev_data: + dev_database: networks: dev_network: diff --git a/server/dev.Dockerfile b/server/dev.Dockerfile index 7df19450..a3f7a515 100644 --- a/server/dev.Dockerfile +++ b/server/dev.Dockerfile @@ -1,9 +1,7 @@ -FROM node:14-alpine +FROM node:16 WORKDIR /usr/app COPY package.json package-lock.json ./ RUN npm install - -COPY . . From 2003d0178e2caaef40faa09f37bcfae85e071ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 16:33:19 +0100 Subject: [PATCH 17/44] chore: Create a new dev-env.sh script to manage dev environment with docker --- .env.example | 19 +++ client/dev.Dockerfile | 8 -- client/package-lock.json | 195 +++++++++++++++++--------- client/package.json | 22 +-- dev-env.sh | 124 ++++++++++++++++ docker-compose.dev.yml | 16 +++ docker-compose.yml | 69 --------- githooks/post-merge.sh | 4 +- githooks/pre-commit.sh | 8 +- server/controllers/user.js | 6 +- server/db/database.js | 17 ++- server/dev.Dockerfile | 7 - server/import-env.js | 38 +++++ server/index.js | 45 +----- server/middlewares/auth.middleware.js | 2 +- server/package-lock.json | 16 +-- server/package.json | 2 +- 17 files changed, 365 insertions(+), 233 deletions(-) create mode 100644 .env.example delete mode 100644 client/dev.Dockerfile create mode 100644 dev-env.sh create mode 100644 docker-compose.dev.yml delete mode 100644 docker-compose.yml delete mode 100644 server/dev.Dockerfile create mode 100644 server/import-env.js diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..f8097d3c --- /dev/null +++ b/.env.example @@ -0,0 +1,19 @@ +# Mariadb container variables +MYSQL_ROOT_PASSWORD=root +MYSQL_DATABASE=apothiquizDb +MYSQL_USER=apothiquizUser +MYSQL_PASSWORD=apothiquizPassword + +# Server environment +NODE_ENV=development +APOTHIQUIZ_SERVER_PORT=5035 +APOTHIQUIZ_ACCESS_TOKEN_KEY=__ACCESS_TMP__ +APOTHIQUIZ_REFRESH_TOKEN_KEY=__REFRESH_TMP__ +APOTHIQUIZ_DB_HOST=localhost # The docker mariadb container is bind on localhost +APOTHIQUIZ_DB_PORT=3306 # Default mariadb port bound in docker-compose.dev.yml +APOTHIQUIZ_DB_DATABASE=apothiquizDb # Same as ${MYSQL_DATABASE} +APOTHIQUIZ_DB_DATABASE_TEST=apothiquizDb # should be different if you don't want to override everything when launching unit tests +APOTHIQUIZ_DB_USER=apothiquizUser # same as ${MYSQL_USER} +APOTHIQUIZ_DB_PASSWORD=apothiquizPassword # same as ${MYSQL_PASSWORD} +APOTHIQUIZ_LDAP_URL=__LDAP_URL__ # todo +APOTHIQUIZ_LDAP_DOMAIN=__LDAP_DOMAIN__ # todo diff --git a/client/dev.Dockerfile b/client/dev.Dockerfile deleted file mode 100644 index f1a71392..00000000 --- a/client/dev.Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM node:16 - -WORKDIR /usr/app - -COPY package.json package-lock.json ./ - -RUN npm install - diff --git a/client/package-lock.json b/client/package-lock.json index 4b292892..885fda39 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -21,10 +21,10 @@ "find-config": "^1.0.0", "node-sass": "^7.0.0", "path": "^0.12.7", + "preval.macro": "^5.0.0", "prop-types": "^15.7.2", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-git-info": "^2.0.0", "react-query": "^3.8.2", "react-router-dom": "^5.2.0", "react-scripts": "^4.0.1", @@ -3130,14 +3130,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@svgr/core/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, "node_modules/@svgr/hast-util-to-babel-ast": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-5.5.0.tgz", @@ -3220,14 +3212,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@svgr/plugin-svgo/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, "node_modules/@svgr/webpack": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/@svgr/webpack/-/webpack-5.5.0.tgz", @@ -5088,6 +5072,67 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-preval": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-preval/-/babel-plugin-preval-5.1.0.tgz", + "integrity": "sha512-G5R+xmo5LS41A4UyZjOjV0mp9AvkuCyUOAJ6TOv/jTZS+VKh7L7HUDRcCSOb0YCM/u0fFarh7Diz0wjY8rFNFg==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "@types/babel__core": "^7.1.12", + "babel-plugin-macros": "^3.0.1", + "require-from-string": "^2.0.2" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/babel-plugin-preval/node_modules/babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + } + }, + "node_modules/babel-plugin-preval/node_modules/cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/babel-plugin-preval/node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", @@ -6842,14 +6887,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cosmiconfig/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, "node_modules/create-ecdh": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", @@ -7774,14 +7811,6 @@ "node": ">=8" } }, - "node_modules/dir-glob/node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "engines": { - "node": ">=8" - } - }, "node_modules/dirty-chai": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/dirty-chai/-/dirty-chai-2.0.1.tgz", @@ -17731,6 +17760,14 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -19148,6 +19185,17 @@ "node": ">= 6" } }, + "node_modules/preval.macro": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/preval.macro/-/preval.macro-5.0.0.tgz", + "integrity": "sha512-+OZRqZYx1pjZ7H5Jis8bPFXkiT7lwA46UzAT4IjuzFVKwkJK+TwIx1TCqrqNCf8U3e5O12mEJEz1BXslkCLWfQ==", + "dependencies": { + "babel-plugin-preval": "^5.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -19612,14 +19660,6 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, - "node_modules/react-git-info": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/react-git-info/-/react-git-info-2.0.0.tgz", - "integrity": "sha512-+PAtJryaKH256xnLNaFg2/YDso6z+OTh93G5Z22tHgyjDazwkjk30TLRwdqUV4LEal2bBmRIKcpATgWg7sBvoA==", - "dependencies": { - "babel-plugin-macros": "^2.8.0" - } - }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -27494,11 +27534,6 @@ "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" } } }, @@ -27553,11 +27588,6 @@ "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" } } }, @@ -29036,13 +29066,49 @@ } }, "babel-plugin-preval": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-preval/-/babel-plugin-preval-5.0.0.tgz", - "integrity": "sha512-8DqJq6/LPUjSZ0Qq6bVIFpsj2flCEE0Cbnbut9TvGU6jP9g3dOWEXtQ/sdvsA9d6souza8eNGh04WRXpuH9ThA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-preval/-/babel-plugin-preval-5.1.0.tgz", + "integrity": "sha512-G5R+xmo5LS41A4UyZjOjV0mp9AvkuCyUOAJ6TOv/jTZS+VKh7L7HUDRcCSOb0YCM/u0fFarh7Diz0wjY8rFNFg==", "requires": { - "@babel/runtime": "^7.9.2", - "babel-plugin-macros": "^2.8.0", + "@babel/runtime": "^7.12.5", + "@types/babel__core": "^7.1.12", + "babel-plugin-macros": "^3.0.1", "require-from-string": "^2.0.2" + }, + "dependencies": { + "babel-plugin-macros": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", + "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", + "requires": { + "@babel/runtime": "^7.12.5", + "cosmiconfig": "^7.0.0", + "resolve": "^1.19.0" + } + }, + "cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + } } }, "babel-plugin-syntax-object-rest-spread": { @@ -30462,11 +30528,6 @@ "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" } } }, @@ -31189,13 +31250,6 @@ "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "requires": { "path-type": "^4.0.0" - }, - "dependencies": { - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" - } } }, "dirty-chai": { @@ -38840,6 +38894,11 @@ } } }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, "pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", diff --git a/client/package.json b/client/package.json index 99bf8a41..223be835 100644 --- a/client/package.json +++ b/client/package.json @@ -1,8 +1,18 @@ { "name": "client", "version": "0.1.0", - "proxy": "http://server:5035", + "proxy": "http://localhost:5035", "private": true, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject", + "lint": "eslint src", + "lint:fix": "eslint --fix src", + "format": "prettier --check .", + "format:write": "prettier --write ." + }, "dependencies": { "@modulz/radix-icons": "^3.2.0", "@radix-ui/react-collapsible": "0.0.1", @@ -30,16 +40,6 @@ "workbox-routing": "^5.1.4", "workbox-strategies": "^5.1.4" }, - "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject", - "lint": "eslint src", - "lint:fix": "eslint --fix src", - "format": "prettier --check .", - "format:write": "prettier --write ." - }, "eslintConfig": { "env": { "browser": true diff --git a/dev-env.sh b/dev-env.sh new file mode 100644 index 00000000..d8a5942a --- /dev/null +++ b/dev-env.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +HELP="Setup script for Apothiquiz dev environment + Available commands: + - start: Start docker containers and run server and client in watch mode + - stop-docker: Stop docker containers + - nuke: Remove all developement data + +" +DC="docker compose --file docker-compose.dev.yml" + +# ----------------------------------------------------------------------------- +# FUNCTIONS +# ----------------------------------------------------------------------------- +fail() { + echo "Error. Exiting." + exit 1 +} + +check_system_dependencies() { + HELP_MESSAGE="Please refer to the developer documentation to find how to install the required dependencies: https://github.com/ValFraNath/apothiquiz/wiki/Developer-setup." + + echo "Checking system dependencies..." + DEPS=("node" "npm" "docker") + + for DEP in "${DEPS[@]}"; do + if ! command -v "$DEP" >/dev/null 2>&1; then + echo "$DEP dependency is missing." + echo "$HELP_MESSAGE" + exit 1 + fi + done + + # TODO check docker compose + # if ! command -v "docker-compose" >/dev/null 2>&1 && ! command -v "docker compose" >/dev/null 2>&1; then + # printf "docker dependency is missing.\n%s" "$HELP_MESSAGE"; + # exit 1; + # fi + + if ! [ -f ".env" ]; then + echo "Missing .env file, creating with default values from .env.example" + echo "Feel free to edit these to match your dev environment" + cp ".env.example" ".env" || fail + echo + fi +} + +check_npm_dependencies() { + echo "Checking npm dependencies..." + for DIR in "client" "server"; do + cd "$DIR" || fail + if ! [ -d "node_modules" ]; then + echo "Installing npm dependencies in $DIR" + npm install + fi + + cd - || fail + done +} + +start_docker() { + $DC up --detach + + until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb)")" == "healthy" ]; do + echo "Waiting for mariadb to be ready..." + sleep 2 + done +} + +stop_docker() { + $DC down +} + +run_server() { + cd "./server/" || fail + npm run start:watch +} + +run_client() { + cd "./client/" || fail + npm run start | tee +} + +# ----------------------------------------------------------------------------- +# ACTUAL SCRIPT +# ----------------------------------------------------------------------------- + +case "$1" in +"start") + check_system_dependencies + check_npm_dependencies + start_docker + run_server & + run_client & + + # Stop when using ctrl+c + wait + wait + exit 0 + ;; + +"stop-docker") + stop_docker + exit 0 + ;; + +"nuke") + read -p "Do you want to remove all your development data (including database)? [yN] " -n 1 -r + echo # newline + if [[ "$REPLY" =~ ^[YyOo]$ ]]; then + $DC down --volumes + echo "Removing client/node_modules" && rm -rf client/node_modules + echo "Removing server/node_modules" && rm -rf server/node_modules + echo "Removing .env" && rm -r .env + fi + exit 0 + ;; + +"help|*") + echo "$HELP" + exit 0 + ;; + +esac diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 00000000..2f3da2dc --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,16 @@ +version: "2.4" + +services: + mariadb: + image: mariadb:10.6 + volumes: + - dev_database:/var/lib/mysql/ + ports: + - 3306:3306 + env_file: + - .env + healthcheck: + test: "exit 0" + +volumes: + dev_database: diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 5405f646..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,69 +0,0 @@ -version: "2.4" - -services: - mariadb: - image: mariadb:10.6 - volumes: - - dev_database:/var/lib/mysql/ - networks: - - dev_network - expose: - - "3306" - environment: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: apothiquizDb - MYSQL_USER: apothiquizUser - MYSQL_PASSWORD: apothiquizPassword - healthcheck: - test: "exit 0" - - server: - build: - context: ./server/ - dockerfile: dev.Dockerfile - command: npm run start:watch - volumes: - - ./server:/usr/app/ - - /usr/app/node_modules - ports: - - 5035:5035 - networks: - - dev_network - depends_on: - mariadb: - condition: service_healthy - environment: - NODE_ENV: development - PORT: 5035 - ACCESS_TOKEN_KEY: __ACCESS_TMP__ - REFRESH_TOKEN_KEY: __REFRESH_TMP__ - DB_HOST: mariadb - DB_USER: apothiquizUser - DB_DATABASE: apothiquizDb - DB_DATABASE_TEST: apothiquizDb - DB_PASSWORD: apothiquizPassword - LDAP_URL: __LDAP_URL__ - LDAP_DOMAIN: __LDAP_DOMAIN__ - - client: - build: - context: ./client/ - dockerfile: dev.Dockerfile - command: npm start - ports: - - 3000:3000 - volumes: - - ./client/:/usr/app/ - - /usr/app/node_modules - networks: - - dev_network - environment: - PORT: 3000 - HOST: client - -volumes: - dev_database: - -networks: - dev_network: - driver: bridge diff --git a/githooks/post-merge.sh b/githooks/post-merge.sh index bbd25ab6..8e3be5b8 100755 --- a/githooks/post-merge.sh +++ b/githooks/post-merge.sh @@ -7,13 +7,13 @@ function changed() { cd "$(git rev-parse --show-toplevel)/server" || exit 1 if changed 'server/package-lock.json'; then echo "📦 server/package-lock.json changed. Running npm install" - docker-compose exec -T server npm install || exit 1 + npm install || exit 1 fi cd "$(git rev-parse --show-toplevel)/client" || exit 1 if changed 'client/package-lock.json'; then echo "📦 client/package-lock.json changed. Running npm install" - docker-compose exec -T client npm install || exit 1 + npm install || exit 1 fi exit 0 diff --git a/githooks/pre-commit.sh b/githooks/pre-commit.sh index 1a073736..af306dfb 100755 --- a/githooks/pre-commit.sh +++ b/githooks/pre-commit.sh @@ -3,15 +3,15 @@ if [ "$(git diff --name-only HEAD | grep "^server/")" != "" ]; then cd "$(git rev-parse --show-toplevel)/server" || exit 1 echo "Linting and formatting server files" - docker-compose exec -T server npm run format:write || exit 1 - docker-compose exec -T server npm run lint:fix -- --max-warnings 0 || exit 1 + npm run format:write || exit 1 + npm run lint:fix -- --max-warnings 0 || exit 1 fi if [ "$(git diff --name-only HEAD | grep "^client/")" != "" ]; then cd "$(git rev-parse --show-toplevel)/client" || exit 1 echo "Linting and formatting client files" - docker-compose exec -T client npm run format:write || exit 1 - docker-compose exec -T client npm run lint:fix -- --max-warnings 0 || exit 1 + npm run format:write || exit 1 + npm run lint:fix -- --max-warnings 0 || exit 1 fi cd "$(git rev-parse --show-toplevel)" || exit 1 diff --git a/server/controllers/user.js b/server/controllers/user.js index 92396756..7b4aaf0e 100644 --- a/server/controllers/user.js +++ b/server/controllers/user.js @@ -370,12 +370,12 @@ async function queryLdap(login, pass) { // auth with regular user const options = { ldapOpts: { - url: process.env.LDAP_URL, + url: process.env.APOTHIQUIZ_LDAP_URL, // tlsOptions: { rejectUnauthorized: false } }, - userDn: `uid=${login},${process.env.LDAP_DOMAIN}`, + userDn: `uid=${login},${process.env.APOTHIQUIZ_LDAP_DOMAIN}`, userPassword: `${pass}`, - userSearchBase: `${process.env.LDAP_DOMAIN}`, + userSearchBase: `${process.env.APOTHIQUIZ_LDAP_DOMAIN}`, usernameAttribute: "uid", username: `${login}`, // starttls: false diff --git a/server/db/database.js b/server/db/database.js index b3c601e2..83cd277d 100644 --- a/server/db/database.js +++ b/server/db/database.js @@ -1,7 +1,6 @@ import fs from "fs/promises"; import path from "path"; -import dotenv from "dotenv"; import mysql from "mysql"; import Logger from "../global/Logger.js"; @@ -10,8 +9,6 @@ const __dirname = path.resolve(); const UPDATES_FILES_DIR = path.resolve(__dirname, "db", "updates"); -dotenv.config(); - // Be sure to add a new version at the end of this array (it must be sorted) const versions = [ "2021-01-08", @@ -36,13 +33,15 @@ const versions = [ */ export const currentAPIVersion = () => versions[versions.length - 1]; -const { NODE_ENV, DB_DATABASE, DB_DATABASE_TEST, DB_HOST, DB_PASSWORD, DB_USER } = process.env; - export const connection = mysql.createConnection({ - host: DB_HOST, - user: DB_USER, - password: DB_PASSWORD, - database: NODE_ENV === "test" ? DB_DATABASE_TEST : DB_DATABASE, + host: process.env.APOTHIQUIZ_DB_HOST, + port: process.env.APOTHIQUIZ_DB_PORT ?? 3306, + user: process.env.APOTHIQUIZ_DB_USER, + password: process.env.APOTHIQUIZ_DB_PASSWORD, + database: + process.env.NODE_ENV === "test" + ? process.env.APOTHIQUIZ_DB_DATABASE_TEST + : process.env.APOTHIQUIZ_DB_DATABASE, multipleStatements: true, }); diff --git a/server/dev.Dockerfile b/server/dev.Dockerfile deleted file mode 100644 index a3f7a515..00000000 --- a/server/dev.Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM node:16 - -WORKDIR /usr/app - -COPY package.json package-lock.json ./ - -RUN npm install diff --git a/server/import-env.js b/server/import-env.js new file mode 100644 index 00000000..25bfa84c --- /dev/null +++ b/server/import-env.js @@ -0,0 +1,38 @@ +import dotenv from "dotenv"; + +import Logger from "./global/Logger.js"; +dotenv.config({ path: "../.env" }); + +/** + * Verify that all required environment variables are defined + * Otherwise, the process is stopped + */ +let needToExit = false; +const keys = [ + "APOTHIQUIZ_ACCESS_TOKEN_KEY", + "APOTHIQUIZ_REFRESH_TOKEN_KEY", + "APOTHIQUIZ_DB_HOST", + "APOTHIQUIZ_DB_USER", + "APOTHIQUIZ_DB_PASSWORD", + process.env.NODE_ENV === "test" ? "APOTHIQUIZ_DB_DATABASE_TEST" : "APOTHIQUIZ_DB_DATABASE", +]; +if (process.env.NODE_ENV === "production") { + keys.push("APOTHIQUIZ_LDAP_URL"); + keys.push("APOTHIQUIZ_LDAP_DOMAIN"); +} + +for (const key of keys) { + if (!process.env[key]) { + Logger.error( + new Error( + `The ${key} environment variable is required but not defined in .env.\ + https://github.com/ValFraNath/apothiquiz/wiki/Production-deployment` + ) + ); + needToExit = true; + } +} + +if (needToExit) { + process.exit(1); +} diff --git a/server/index.js b/server/index.js index c4d99149..964bc963 100644 --- a/server/index.js +++ b/server/index.js @@ -1,25 +1,22 @@ import fs from "fs"; import bodyParser from "body-parser"; -import dotenv from "dotenv"; import express from "express"; +import "./import-env.js"; // Must be imported before other scripts to load environment variables + import { checkDuelsTask, removeDuelsTask } from "./cron-scripts/cron-tasks.js"; import Database from "./db/database.js"; import Logger from "./global/Logger.js"; import RequestSyntaxErrorHandler from "./middlewares/error.middleware.js"; import apiRouter from "./routes/api.route.js"; -dotenv.config(); - -const PORT = process.env.PORT || 5035; +const PORT = process.env.APOTHIQUIZ_SERVER_PORT || 5035; const FILES_DIR = process.env.NODE_ENV === "test" ? "files-test" : "files"; const app = express(); app.isReady = false; -checkEnv(); - fs.mkdirSync(FILES_DIR, { recursive: true }); app.use(bodyParser.json()); @@ -61,40 +58,4 @@ app.waitReady = function (callback, interval = 100) { }, interval); }; -/** - * Verify that all required environment variables are defined - * Otherwise, the process is stopped - */ -function checkEnv() { - let needToExit = false; - const keys = [ - "ACCESS_TOKEN_KEY", - "REFRESH_TOKEN_KEY", - "DB_HOST", - "DB_USER", - "DB_PASSWORD", - process.env.NODE_ENV === "test" ? "DB_DATABASE_TEST" : "DB_DATABASE", - ]; - - if (process.env.NODE_ENV === "production") { - keys.push("LDAP_URL"); - keys.push("LDAP_DOMAIN"); - } - for (const key of keys) { - if (!process.env[key]) { - Logger.error( - new Error( - `The ${key} environment variable is required but not defined in .env.\ - https://github.com/ValFraNath/apothiquiz/wiki/Production-deployment` - ) - ); - needToExit = true; - } - } - - if (needToExit) { - process.exit(1); - } -} - export default app; diff --git a/server/middlewares/auth.middleware.js b/server/middlewares/auth.middleware.js index 3aa0db74..745daf0b 100644 --- a/server/middlewares/auth.middleware.js +++ b/server/middlewares/auth.middleware.js @@ -14,7 +14,7 @@ function AuthMiddleware(onlyAdmin = false) { const res = new HttpResponseWrapper(_res); try { const token = req.headers.authorization.split(" ")[1]; - const { user, isAdmin } = jwt.verify(token, process.env.ACCESS_TOKEN_KEY); + const { user, isAdmin } = jwt.verify(token, process.env.APOTHIQUIZ_ACCESS_TOKEN_KEY); if (onlyAdmin && !isAdmin) { return res.sendUsageError(403, "Access denied"); } diff --git a/server/package-lock.json b/server/package-lock.json index ab3fbdc3..1ea9d35e 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -17,7 +17,7 @@ "csv-reader": "^1.0.7", "dateformat": "^4.5.1", "deep-equal-in-any-order": "^1.0.28", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "express": "^4.17.1", "js-levenshtein": "^1.1.6", "jsonwebtoken": "^8.5.1", @@ -1410,11 +1410,11 @@ } }, "node_modules/dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", + "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==", "engines": { - "node": ">=8" + "node": ">=12" } }, "node_modules/duplexer3": { @@ -6735,9 +6735,9 @@ } }, "dotenv": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", - "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.0.tgz", + "integrity": "sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==" }, "duplexer3": { "version": "0.1.4", diff --git a/server/package.json b/server/package.json index 83e2a0c3..cd65b6d0 100644 --- a/server/package.json +++ b/server/package.json @@ -87,7 +87,7 @@ "csv-reader": "^1.0.7", "dateformat": "^4.5.1", "deep-equal-in-any-order": "^1.0.28", - "dotenv": "^8.2.0", + "dotenv": "^16.0.0", "express": "^4.17.1", "js-levenshtein": "^1.1.6", "jsonwebtoken": "^8.5.1", From d4d9ec66a7c7915a75c0ab4e222a68296dde63ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 16:35:31 +0100 Subject: [PATCH 18/44] chore(ci): Update variable environment names --- .github/workflows/node.js.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 2e2a6d48..4ea25c96 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -57,7 +57,7 @@ jobs: mariadb version: "10.4.10" mysql database: "apothiquizTestDb" mysql user: "apothiquizUser" - mysql password: ${{ secrets.CI_DATABASE_PASS }} + mysql password: "p@ssword" - run: npm ci working-directory: ./server @@ -73,12 +73,12 @@ jobs: - name: Setting private key run: | - echo "ACCESS_TOKEN_KEY=TMP_ACCESS_KEY" >> .env; \ - echo "REFRESH_TOKEN_KEY=TMP_REFRESH_KEY" >> .env; \ - echo "DB_HOST=localhost" >> .env; \ - echo "DB_USER=apothiquizUser" >> .env; \ - echo "DB_PASSWORD=p@ssword" >> .env; \ - echo "DB_DATABASE_TEST=apothiquizTestDb" >> .env; \ + echo "APOTHIQUIZ_ACCESS_TOKEN_KEY=TMP_ACCESS_KEY" >> .env; \ + echo "APOTHIQUIZ_REFRESH_TOKEN_KEY=TMP_REFRESH_KEY" >> .env; \ + echo "APOTHIQUIZ_DB_HOST=localhost" >> .env; \ + echo "APOTHIQUIZ_DB_USER=apothiquizUser" >> .env; \ + echo "APOTHIQUIZ_DB_PASSWORD=p@ssword" >> .env; \ + echo "APOTHIQUIZ_DB_DATABASE_TEST=apothiquizTestDb" >> .env; \ working-directory: ./server From 3f47d17f6a4fc1aa3fddf9e0064a3a6537fcde0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 16:42:43 +0100 Subject: [PATCH 19/44] chore: Rename main .env to dev.env --- .gitignore | 2 ++ dev-env.sh | 22 +++++++++++++--------- server/import-env.js | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a6d15a6a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.env +!.env.example diff --git a/dev-env.sh b/dev-env.sh index d8a5942a..5ff24f44 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -1,11 +1,10 @@ #!/bin/bash HELP="Setup script for Apothiquiz dev environment - Available commands: - - start: Start docker containers and run server and client in watch mode - - stop-docker: Stop docker containers - - nuke: Remove all developement data - +Available commands: + - start: Start docker containers and run server and client in watch mode + - stop-docker: Stop docker containers + - nuke: Remove all developement data " DC="docker compose --file docker-compose.dev.yml" @@ -37,10 +36,10 @@ check_system_dependencies() { # exit 1; # fi - if ! [ -f ".env" ]; then - echo "Missing .env file, creating with default values from .env.example" + if ! [ -f "dev.env" ]; then + echo "Missing dev.env file, creating with default values from .env.example" echo "Feel free to edit these to match your dev environment" - cp ".env.example" ".env" || fail + cp ".env.example" "dev.env" || fail echo fi } @@ -85,6 +84,11 @@ run_client() { # ACTUAL SCRIPT # ----------------------------------------------------------------------------- +if [ -z "$1" ]; then + echo "$HELP" + exit 0 +fi + case "$1" in "start") check_system_dependencies @@ -111,7 +115,7 @@ case "$1" in $DC down --volumes echo "Removing client/node_modules" && rm -rf client/node_modules echo "Removing server/node_modules" && rm -rf server/node_modules - echo "Removing .env" && rm -r .env + echo "Removing dev.env" && rm -r dev.env fi exit 0 ;; diff --git a/server/import-env.js b/server/import-env.js index 25bfa84c..f388d0f9 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -1,7 +1,7 @@ import dotenv from "dotenv"; import Logger from "./global/Logger.js"; -dotenv.config({ path: "../.env" }); +dotenv.config({ path: "../dev.env" }); // TODO do not hardcode this /** * Verify that all required environment variables are defined From 30a4389abcea57ed75f849817bd09bb95db2d5fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 17:02:23 +0100 Subject: [PATCH 20/44] fix: Do not hardcode .env file path in import-env.js --- dev-env.sh | 5 +++-- server/import-env.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index 5ff24f44..e67c8041 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -72,12 +72,13 @@ stop_docker() { run_server() { cd "./server/" || fail - npm run start:watch + npm run start:watch -- --config="../dev.env" } run_client() { cd "./client/" || fail - npm run start | tee + # Use tee to make react-scripts thinks it's not an interactive console + npm run start | tee } # ----------------------------------------------------------------------------- diff --git a/server/import-env.js b/server/import-env.js index f388d0f9..b5a3f1fd 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -1,7 +1,14 @@ import dotenv from "dotenv"; - import Logger from "./global/Logger.js"; -dotenv.config({ path: "../dev.env" }); // TODO do not hardcode this + +let configFile = ".env"; +process.argv.forEach(arg => { + if (arg.startsWith("--config")) { + configFile = arg.split("=")[1]; + } +}); + +dotenv.config({ path: configFile }); /** * Verify that all required environment variables are defined From 1cd7b3817f2f8703ac6f65b93b19ebb325592c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 17:35:24 +0100 Subject: [PATCH 21/44] chore: Formatting --- server/import-env.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/import-env.js b/server/import-env.js index b5a3f1fd..9503211c 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -11,7 +11,7 @@ process.argv.forEach(arg => { dotenv.config({ path: configFile }); /** - * Verify that all required environment variables are defined + * Check that all required environment variables are defined * Otherwise, the process is stopped */ let needToExit = false; From 0ba2fbfe8f6e79fed4938f5cc5555b16a7be1d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 18:59:45 +0100 Subject: [PATCH 22/44] docs: Minor changes to match the wiki --- .env.example | 10 +++++++++- .gitignore | 2 ++ server/import-env.js | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index f8097d3c..23df3963 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,20 @@ +# ----------------------------------------------------------------------------- # Mariadb container variables MYSQL_ROOT_PASSWORD=root MYSQL_DATABASE=apothiquizDb MYSQL_USER=apothiquizUser MYSQL_PASSWORD=apothiquizPassword -# Server environment +# ----------------------------------------------------------------------------- +# OpenLDAP container variables + +# ----------------------------------------------------------------------------- +# Server configuration NODE_ENV=development APOTHIQUIZ_SERVER_PORT=5035 + +# Token private keys : for production, these keys must be random hashes ! +# https://www.random.org/passwords/?num=5&len=24&format=html&rnd=new or `openssl rand -base64 32` APOTHIQUIZ_ACCESS_TOKEN_KEY=__ACCESS_TMP__ APOTHIQUIZ_REFRESH_TOKEN_KEY=__REFRESH_TMP__ APOTHIQUIZ_DB_HOST=localhost # The docker mariadb container is bind on localhost diff --git a/.gitignore b/.gitignore index a6d15a6a..6bf1a422 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.env !.env.example + +docker-compose.override.yml diff --git a/server/import-env.js b/server/import-env.js index 9503211c..f0487d51 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -1,8 +1,9 @@ import dotenv from "dotenv"; + import Logger from "./global/Logger.js"; let configFile = ".env"; -process.argv.forEach(arg => { +process.argv.forEach((arg) => { if (arg.startsWith("--config")) { configFile = arg.split("=")[1]; } From e83bfc6ca9c47e3c3f580175982565be03cc8938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 19:02:11 +0100 Subject: [PATCH 23/44] chore: Remove docker for production --- client/.dockerignore | 1 - client/Dockerfile | 29 ----------------- docker-compose.prod.yml | 72 ----------------------------------------- server/.dockerignore | 7 ---- server/Dockerfile | 15 --------- 5 files changed, 124 deletions(-) delete mode 100644 client/.dockerignore delete mode 100644 client/Dockerfile delete mode 100644 docker-compose.prod.yml delete mode 100644 server/.dockerignore delete mode 100644 server/Dockerfile diff --git a/client/.dockerignore b/client/.dockerignore deleted file mode 100644 index 07e6e472..00000000 --- a/client/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -/node_modules diff --git a/client/Dockerfile b/client/Dockerfile deleted file mode 100644 index fb67707f..00000000 --- a/client/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM node:14-alpine as builder - -ARG REACT_APP_VERSION="development" - -WORKDIR /app - -COPY package*.json ./ -RUN npm install --only=production - -# Manually copying public and src to not copy rootfs/ -COPY public/ ./public/ -COPY src/ ./src/ - -RUN npm run build - -# ------------------------------------------------------ -# Production Build -# ------------------------------------------------------ -FROM nginx:1.16.0-alpine - -RUN rm /etc/nginx/conf.d/default.conf - -COPY rootfs/ / - -COPY --from=builder /app/build /usr/share/nginx/html/ - -EXPOSE 80 - -CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml deleted file mode 100644 index 6b376ccb..00000000 --- a/docker-compose.prod.yml +++ /dev/null @@ -1,72 +0,0 @@ -version: "2.4" - -services: - mariadb_db: - image: mariadb:10.6 - container_name: apothiquiz_db - restart: unless-stopped - volumes: - - apothiquiz_data:/var/lib/mysql/ - networks: - - apothiquiz_network - expose: - - "3306" - environment: - MYSQL_ROOT_PASSWORD: __YOUR_PASSWORD_HERE__ - MYSQL_DATABASE: apothiquizDb - MYSQL_USER: apothiquizUser - MYSQL_PASSWORD: __YOUR_PASSWORD_HERE__ - healthcheck: - test: "exit 0" - - server: - image: valfranath/apothiquiz-server - build: server/ - depends_on: - mariadb_db: - condition: service_healthy - - container_name: apothiquiz_server - restart: unless-stopped - networks: - - apothiquiz_network - environment: - PORT: 80 - ACCESS_TOKEN_KEY: __ACCESS_TMP__ - REFRESH_TOKEN_KEY: __REFRESH_TMP__ - DB_HOST: apothiquiz_db - DB_USER: apothiquizUser - DB_PASSWORD: __YOUR_PASSWORD_HERE__ - DB_DATABASE: apothiquizDb - LDAP_URL: 'ldap://ldap.univ-fcomte.fr' - LDAP_DOMAIN: 'ou=people,dc=univ-fcomte,dc=fr' - - client: - image: valfranath/apothiquiz-client - build: client/ - container_name: apothiquiz_client - restart: unless-stopped - networks: - - apothiquiz_network - - proxy: - image: nginx:1.16.0-alpine - depends_on: - - server - - client - container_name: apothiquiz_proxy - restart: unless-stopped - volumes: - - $PWD/rootfs/nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro - ports: - - 61100:80 - - networks: - - apothiquiz_network - -volumes: - apothiquiz_data: - -networks: - apothiquiz_network: - driver: bridge diff --git a/server/.dockerignore b/server/.dockerignore deleted file mode 100644 index 028ac3fa..00000000 --- a/server/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -.eslintcache -.env -node_modules/ -logs/ -files/ -files-test/ -uploads/ diff --git a/server/Dockerfile b/server/Dockerfile deleted file mode 100644 index d9d73d52..00000000 --- a/server/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:14-alpine - -WORKDIR /app - -COPY package*.json ./ - -RUN npm install --only=production - -COPY . . - -ENV PORT 5035 - -EXPOSE 5035 - -CMD ["node", "index.js"] From 35a752b04bcc0fbaec9c0480347ac7f2e2bcafe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 19:06:31 +0100 Subject: [PATCH 24/44] fix: Replace .env by dev.env in docker-compose.dev.yml --- docker-compose.dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 2f3da2dc..c7a8e0ba 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -8,7 +8,7 @@ services: ports: - 3306:3306 env_file: - - .env + - dev.env healthcheck: test: "exit 0" From a12da90d2a133eb6823f78840e30efdaaa329de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 20:52:20 +0100 Subject: [PATCH 25/44] feat: dev-env.sh test (but tests are failing) --- .env.example | 1 - dev-env.sh | 40 ++++++++++++++++++++++++++++++++++------ docker-compose.dev.yml | 19 ++++++++++++++++++- server/import-env.js | 1 + 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 23df3963..0f55b99f 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,5 @@ # ----------------------------------------------------------------------------- # Mariadb container variables -MYSQL_ROOT_PASSWORD=root MYSQL_DATABASE=apothiquizDb MYSQL_USER=apothiquizUser MYSQL_PASSWORD=apothiquizPassword diff --git a/dev-env.sh b/dev-env.sh index e67c8041..2c4ef33d 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -4,6 +4,7 @@ HELP="Setup script for Apothiquiz dev environment Available commands: - start: Start docker containers and run server and client in watch mode - stop-docker: Stop docker containers + - test: Launch unit tests - nuke: Remove all developement data " DC="docker compose --file docker-compose.dev.yml" @@ -58,7 +59,7 @@ check_npm_dependencies() { } start_docker() { - $DC up --detach + $DC up mariadb --detach until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb)")" == "healthy" ]; do echo "Waiting for mariadb to be ready..." @@ -67,7 +68,7 @@ start_docker() { } stop_docker() { - $DC down + $DC stop mariadb } run_server() { @@ -75,10 +76,28 @@ run_server() { npm run start:watch -- --config="../dev.env" } +test_server() { + echo "Running tests with a temporary database" + $DC up mariadb-test --detach + + until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb-test)")" == "healthy" ]; do + echo "Waiting for mariadb-test to be ready..." + sleep 2 + done + + export $(grep --only-matching "APOTHIQUIZ_.*=[^ ]*" dev.env | xargs) + export APOTHIQUIZ_DB_PORT=3307 # 3307 is the port for the test database + cd "./server/" || fail + npm run test + + cd "../" || fail + $DC down mariadb-test +} + run_client() { cd "./client/" || fail # Use tee to make react-scripts thinks it's not an interactive console - npm run start | tee + npm run start | tee } # ----------------------------------------------------------------------------- @@ -98,9 +117,9 @@ case "$1" in run_server & run_client & - # Stop when using ctrl+c - wait - wait + trap stop_docker SIGINT # Stop docker on ctrl+c + + wait # Do not stop the script until the commands are finished exit 0 ;; @@ -109,6 +128,15 @@ case "$1" in exit 0 ;; +"test") + check_system_dependencies + check_npm_dependencies + test_server & + + wait + exit 0 + ;; + "nuke") read -p "Do you want to remove all your development data (including database)? [yN] " -n 1 -r echo # newline diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index c7a8e0ba..4ca3ab77 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -9,8 +9,25 @@ services: - 3306:3306 env_file: - dev.env + environment: + MYSQL_ROOT_PASSWORD: root healthcheck: - test: "exit 0" + test: "mysql --user=root --password=root --execute 'SHOW DATABASES;'" + interval: 5s + start_period: 1m + + mariadb-test: + image: mariadb:10.6 + ports: + - 3307:3306 + env_file: + - dev.env + environment: + MYSQL_ROOT_PASSWORD: root + healthcheck: + test: "mysql --user=root --password=root --execute 'SHOW DATABASES;'" + interval: 5s + start_period: 1m volumes: dev_database: diff --git a/server/import-env.js b/server/import-env.js index f0487d51..3ec18b91 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -31,6 +31,7 @@ if (process.env.NODE_ENV === "production") { for (const key of keys) { if (!process.env[key]) { + console.debug(key, "=", process.env[key]); Logger.error( new Error( `The ${key} environment variable is required but not defined in .env.\ From b15a1d19d3b28fe2d1c4dd80decfbe993c05e32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 20:57:25 +0100 Subject: [PATCH 26/44] ci: Fix env variables? --- .github/workflows/node.js.yml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 4ea25c96..8bda44e7 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -40,6 +40,14 @@ jobs: matrix: node-version: [14.x] + env: + APOTHIQUIZ_ACCESS_TOKEN_KEY: TMP_ACCESS_KEY" + APOTHIQUIZ_REFRESH_TOKEN_KEY: TMP_REFRESH_KEY" + APOTHIQUIZ_DB_HOST: localhost" + APOTHIQUIZ_DB_DATABASE_TEST: apothiquizTestDb" + APOTHIQUIZ_DB_USER: apothiquizUser" + APOTHIQUIZ_DB_PASSWORD: p@ssword + steps: - uses: actions/checkout@v2 @@ -55,9 +63,9 @@ jobs: uses: getong/mariadb-action@v1.1 with: mariadb version: "10.4.10" - mysql database: "apothiquizTestDb" - mysql user: "apothiquizUser" - mysql password: "p@ssword" + mysql database: ${APOTHIQUIZ_DB_DATABASE_TEST} + mysql user: ${APOTHIQUIZ_DB_USER} + mysql password: ${APOTHIQUIZ_DB_PASSWORD} - run: npm ci working-directory: ./server @@ -71,17 +79,6 @@ jobs: - run: npm run build --if-present working-directory: ./server - - name: Setting private key - run: | - echo "APOTHIQUIZ_ACCESS_TOKEN_KEY=TMP_ACCESS_KEY" >> .env; \ - echo "APOTHIQUIZ_REFRESH_TOKEN_KEY=TMP_REFRESH_KEY" >> .env; \ - echo "APOTHIQUIZ_DB_HOST=localhost" >> .env; \ - echo "APOTHIQUIZ_DB_USER=apothiquizUser" >> .env; \ - echo "APOTHIQUIZ_DB_PASSWORD=p@ssword" >> .env; \ - echo "APOTHIQUIZ_DB_DATABASE_TEST=apothiquizTestDb" >> .env; \ - - working-directory: ./server - - name: Wait for mariadb server to be ready env: PORT: 3306 From b3cc57a211c153f13c44395a1e3c5b8113a662fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 25 Mar 2022 20:58:45 +0100 Subject: [PATCH 27/44] ci: Fix trailing quotes --- .github/workflows/node.js.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 8bda44e7..c2a2e05a 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -41,11 +41,11 @@ jobs: node-version: [14.x] env: - APOTHIQUIZ_ACCESS_TOKEN_KEY: TMP_ACCESS_KEY" - APOTHIQUIZ_REFRESH_TOKEN_KEY: TMP_REFRESH_KEY" - APOTHIQUIZ_DB_HOST: localhost" - APOTHIQUIZ_DB_DATABASE_TEST: apothiquizTestDb" - APOTHIQUIZ_DB_USER: apothiquizUser" + APOTHIQUIZ_ACCESS_TOKEN_KEY: TMP_ACCESS_KEY + APOTHIQUIZ_REFRESH_TOKEN_KEY: TMP_REFRESH_KEY + APOTHIQUIZ_DB_HOST: localhost + APOTHIQUIZ_DB_DATABASE_TEST: apothiquizTestDb + APOTHIQUIZ_DB_USER: apothiquizUser APOTHIQUIZ_DB_PASSWORD: p@ssword steps: From 39b139b0cac2759dfbf28b9564d531ee2f77672d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 27 Mar 2022 19:51:50 +0200 Subject: [PATCH 28/44] fix: *) case in dev-env.sh --- dev-env.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-env.sh b/dev-env.sh index 2c4ef33d..207dde7b 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -85,6 +85,7 @@ test_server() { sleep 2 done + # shellcheck disable=SC2046 # We want the attributes to be treated separately export $(grep --only-matching "APOTHIQUIZ_.*=[^ ]*" dev.env | xargs) export APOTHIQUIZ_DB_PORT=3307 # 3307 is the port for the test database cd "./server/" || fail @@ -149,7 +150,7 @@ case "$1" in exit 0 ;; -"help|*") +"help"|*) echo "$HELP" exit 0 ;; From 5a304e53aa1ae478a26d22d19ef28f860d920f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 27 Mar 2022 19:57:08 +0200 Subject: [PATCH 29/44] chore: Removed useless console.debug --- server/controllers/question.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/controllers/question.js b/server/controllers/question.js index 270d8090..20071244 100644 --- a/server/controllers/question.js +++ b/server/controllers/question.js @@ -233,8 +233,6 @@ function formatQuestion(data) { const answers = badAnswers.slice(); answers.splice(randomIndex, 0, goodAnswer); - console.debug(answers); - return { subject: data[0].subject, goodAnswer: randomIndex, From f27dbdf15ed0d9121f4b0e47ccd265a0b793a00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 27 Mar 2022 20:01:24 +0200 Subject: [PATCH 30/44] fix: Refresh & access tokens now use the new env variables --- server/global/Tokens.js | 10 +++++----- server/import-env.js | 1 - server/test/user.test.js | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/server/global/Tokens.js b/server/global/Tokens.js index dc701cc6..c79c32a3 100644 --- a/server/global/Tokens.js +++ b/server/global/Tokens.js @@ -8,9 +8,9 @@ import { queryPromise } from "../db/database.js"; * @returns {string} The token */ function createAccessToken(refreshToken) { - const { ACCESS_TOKEN_KEY, REFRESH_TOKEN_KEY } = process.env; - const { user, isAdmin } = jwt.verify(refreshToken, REFRESH_TOKEN_KEY); - return jwt.sign({ user, isAdmin }, ACCESS_TOKEN_KEY, { expiresIn: "10m" }); + const { APOTHIQUIZ_ACCESS_TOKEN_KEY, APOTHIQUIZ_REFRESH_TOKEN_KEY } = process.env; + const { user, isAdmin } = jwt.verify(refreshToken, APOTHIQUIZ_REFRESH_TOKEN_KEY); + return jwt.sign({ user, isAdmin }, APOTHIQUIZ_ACCESS_TOKEN_KEY, { expiresIn: "10m" }); } /** @@ -20,8 +20,8 @@ function createAccessToken(refreshToken) { * @returns {Promise} The token */ async function createRefreshToken(login, isAdmin) { - const { REFRESH_TOKEN_KEY } = process.env; - const token = jwt.sign({ user: login, isAdmin }, REFRESH_TOKEN_KEY); + const { APOTHIQUIZ_REFRESH_TOKEN_KEY } = process.env; + const token = jwt.sign({ user: login, isAdmin }, APOTHIQUIZ_REFRESH_TOKEN_KEY); await storeRefreshToken(token, login); return token; } diff --git a/server/import-env.js b/server/import-env.js index 3ec18b91..f0487d51 100644 --- a/server/import-env.js +++ b/server/import-env.js @@ -31,7 +31,6 @@ if (process.env.NODE_ENV === "production") { for (const key of keys) { if (!process.env[key]) { - console.debug(key, "=", process.env[key]); Logger.error( new Error( `The ${key} environment variable is required but not defined in .env.\ diff --git a/server/test/user.test.js b/server/test/user.test.js index a19620fb..03db5151 100644 --- a/server/test/user.test.js +++ b/server/test/user.test.js @@ -13,14 +13,14 @@ chai.use(chaiHttp); const { expect } = chai; describe("User test", function () { function decodeRefreshToken(refreshToken) { - const { REFRESH_TOKEN_KEY } = process.env; - const { user, isAdmin } = jwt.verify(refreshToken, REFRESH_TOKEN_KEY); + const { APOTHIQUIZ_REFRESH_TOKEN_KEY } = process.env; + const { user, isAdmin } = jwt.verify(refreshToken, APOTHIQUIZ_REFRESH_TOKEN_KEY); return { user, isAdmin }; } function decodeAccessToken(accessToken) { - const { ACCESS_TOKEN_KEY } = process.env; - const { user, isAdmin } = jwt.verify(accessToken, ACCESS_TOKEN_KEY); + const { APOTHIQUIZ_ACCESS_TOKEN_KEY } = process.env; + const { user, isAdmin } = jwt.verify(accessToken, APOTHIQUIZ_ACCESS_TOKEN_KEY); return { user, isAdmin }; } From c3f81d0153b5b9411a4724296b1b903ddbb1de79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Sun, 27 Mar 2022 20:10:09 +0200 Subject: [PATCH 31/44] chore: Remove rootfs/ and bring back production version in about page --- client/package.json | 2 +- .../rootfs/etc/nginx/conf.d/nginx-react.conf | 16 ---------------- rootfs/etc/nginx/nginx.conf | 19 ------------------- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 client/rootfs/etc/nginx/conf.d/nginx-react.conf delete mode 100644 rootfs/etc/nginx/nginx.conf diff --git a/client/package.json b/client/package.json index 223be835..892fd20b 100644 --- a/client/package.json +++ b/client/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", + "build": "REACT_APP_VERSION=\"Production (hash $(git rev-parse --short HEAD))\" react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "lint": "eslint src", diff --git a/client/rootfs/etc/nginx/conf.d/nginx-react.conf b/client/rootfs/etc/nginx/conf.d/nginx-react.conf deleted file mode 100644 index d70b246a..00000000 --- a/client/rootfs/etc/nginx/conf.d/nginx-react.conf +++ /dev/null @@ -1,16 +0,0 @@ -server { - listen 80; - - root /usr/share/nginx/html; - - location / { - index index.html; - try_files $uri /index.html =404; - add_header Cache-Control "no-store, no-cache, must-revalidate"; - } - - location /static { - expires 1y; - add_header Cache-Control "public"; - } -} diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf deleted file mode 100644 index 51c68d79..00000000 --- a/rootfs/etc/nginx/nginx.conf +++ /dev/null @@ -1,19 +0,0 @@ -server { - charset utf-8; - client_max_body_size 50M; - - location / { - proxy_pass http://client; - } - - location /api/ { - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_next_upstream error timeout http_502 http_503 http_504; - - proxy_pass http://server/api/; - } -} From 2a51d231ff3ab057380a534e143f03a8bdfc09e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 15:15:37 +0100 Subject: [PATCH 32/44] fix: successful user authentification with ldap --- .env.example | 16 ++++++++-------- docker-compose.dev.yml | 24 ++++++++++++++++++++++++ server/controllers/user.js | 13 +++++++------ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.env.example b/.env.example index 0f55b99f..fbb942c8 100644 --- a/.env.example +++ b/.env.example @@ -16,11 +16,11 @@ APOTHIQUIZ_SERVER_PORT=5035 # https://www.random.org/passwords/?num=5&len=24&format=html&rnd=new or `openssl rand -base64 32` APOTHIQUIZ_ACCESS_TOKEN_KEY=__ACCESS_TMP__ APOTHIQUIZ_REFRESH_TOKEN_KEY=__REFRESH_TMP__ -APOTHIQUIZ_DB_HOST=localhost # The docker mariadb container is bind on localhost -APOTHIQUIZ_DB_PORT=3306 # Default mariadb port bound in docker-compose.dev.yml -APOTHIQUIZ_DB_DATABASE=apothiquizDb # Same as ${MYSQL_DATABASE} -APOTHIQUIZ_DB_DATABASE_TEST=apothiquizDb # should be different if you don't want to override everything when launching unit tests -APOTHIQUIZ_DB_USER=apothiquizUser # same as ${MYSQL_USER} -APOTHIQUIZ_DB_PASSWORD=apothiquizPassword # same as ${MYSQL_PASSWORD} -APOTHIQUIZ_LDAP_URL=__LDAP_URL__ # todo -APOTHIQUIZ_LDAP_DOMAIN=__LDAP_DOMAIN__ # todo +APOTHIQUIZ_DB_HOST=localhost # The docker mariadb container is bind on localhost +APOTHIQUIZ_DB_PORT=3306 # Default mariadb port bound in docker-compose.dev.yml +APOTHIQUIZ_DB_DATABASE=apothiquizDb # Same as ${MYSQL_DATABASE} +APOTHIQUIZ_DB_DATABASE_TEST=apothiquizDb # should be different if you don't want to override everything when launching unit tests +APOTHIQUIZ_DB_USER=apothiquizUser # same as ${MYSQL_USER} +APOTHIQUIZ_DB_PASSWORD=apothiquizPassword # same as ${MYSQL_PASSWORD} +APOTHIQUIZ_LDAP_URL=ldap://localhost # Container use default ldap port in docker-compose.dev.yml +APOTHIQUIZ_LDAP_DOMAIN="ou=users,dc=apothiquiz,dc=io" # Configured in docker-compose.dev.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 4ca3ab77..921ff425 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -29,5 +29,29 @@ services: interval: 5s start_period: 1m + openldap: + image: osixia/openldap:1.5.0 + volumes: + - dev_ldap:/var/lib/ldap + - dev_ldap:/etc/ldap/slapd.d + ports: + - 389:389 + - 636:636 + environment: + LDAP_ORGANISATION: "apothiquiz" + LDAP_DOMAIN: "apothiquiz.io" + LDAP_ADMIN_PASSWORD: "password" # user login is cn=admin,dc=apothiquiz,dc=io + + phpldapadmin: + image: osixia/phpldapadmin:0.9.0 + environment: + PHPLDAPADMIN_LDAP_HOSTS: "ldap" + PHPLDAPADMIN_HTTPS: "false" + ports: + - 8888:80 + links: + - "openldap:ldap" + volumes: dev_database: + dev_ldap: diff --git a/server/controllers/user.js b/server/controllers/user.js index 7b4aaf0e..09cea6d3 100644 --- a/server/controllers/user.js +++ b/server/controllers/user.js @@ -367,26 +367,27 @@ async function doesUserExist(login) { * @returns {boolean} Boolean telling if the user is well authenticated */ async function queryLdap(login, pass) { - // auth with regular user const options = { ldapOpts: { url: process.env.APOTHIQUIZ_LDAP_URL, // tlsOptions: { rejectUnauthorized: false } }, userDn: `uid=${login},${process.env.APOTHIQUIZ_LDAP_DOMAIN}`, - userPassword: `${pass}`, - userSearchBase: `${process.env.APOTHIQUIZ_LDAP_DOMAIN}`, + userPassword: pass, usernameAttribute: "uid", username: `${login}`, - // starttls: false }; try { await authenticate(options); + return true; } catch (e) { - return false; + if (e.name === "InvalidCredentialsError") { + return false; + } + + throw e; } - return true; } /** From d43ab3643ecb30b2da0d642d7009ca3fb1cfb710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 15:16:20 +0100 Subject: [PATCH 33/44] docs: better dev-env script --- dev-env.sh | 66 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index 207dde7b..1df2ddb0 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -9,24 +9,35 @@ Available commands: " DC="docker compose --file docker-compose.dev.yml" +set -e +set -o pipefail + # ----------------------------------------------------------------------------- # FUNCTIONS # ----------------------------------------------------------------------------- fail() { echo "Error. Exiting." + stop_docker + echo "Exited because of an error." exit 1 } +colored_echo() { + GREEN="\e[42m" + DEFAULT="\e[0m" + echo -e "${GREEN}${1}${DEFAULT}" +} + check_system_dependencies() { HELP_MESSAGE="Please refer to the developer documentation to find how to install the required dependencies: https://github.com/ValFraNath/apothiquiz/wiki/Developer-setup." - echo "Checking system dependencies..." + colored_echo "Checking system dependencies..." DEPS=("node" "npm" "docker") for DEP in "${DEPS[@]}"; do if ! command -v "$DEP" >/dev/null 2>&1; then - echo "$DEP dependency is missing." - echo "$HELP_MESSAGE" + colored_echo "$DEP dependency is missing." + colored_echo "$HELP_MESSAGE" exit 1 fi done @@ -38,50 +49,54 @@ check_system_dependencies() { # fi if ! [ -f "dev.env" ]; then - echo "Missing dev.env file, creating with default values from .env.example" - echo "Feel free to edit these to match your dev environment" + colored_echo "Missing dev.env file, creating with default values from .env.example" + colored_echo "Feel free to edit your local .env to match your dev environment" cp ".env.example" "dev.env" || fail - echo + colored_echo fi + + colored_echo "...OK!" } check_npm_dependencies() { - echo "Checking npm dependencies..." + colored_echo "Checking npm dependencies..." for DIR in "client" "server"; do cd "$DIR" || fail - if ! [ -d "node_modules" ]; then - echo "Installing npm dependencies in $DIR" + if ! [ -d "node_modules" ] || ! npm list --all >/dev/null 2>&1; then + colored_echo "Installing npm dependencies in $DIR" npm install fi - cd - || fail + cd - >/dev/null || fail done + colored_echo "...OK!" } +SERVICES=("mariadb" "openldap" "phpldapadmin") start_docker() { - $DC up mariadb --detach + $DC up "${SERVICES[@]}" --detach || fail until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb)")" == "healthy" ]; do - echo "Waiting for mariadb to be ready..." + colored_echo "Waiting for mariadb to be ready..." sleep 2 done } stop_docker() { - $DC stop mariadb + $DC stop "${SERVICES[@]}" } run_server() { cd "./server/" || fail - npm run start:watch -- --config="../dev.env" + npm run start:watch -- --config="../dev.env" || fail } test_server() { - echo "Running tests with a temporary database" + colored_echo "Running tests with a temporary database" $DC up mariadb-test --detach until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb-test)")" == "healthy" ]; do - echo "Waiting for mariadb-test to be ready..." + colored_echo "Waiting for mariadb-test to be ready..." sleep 2 done @@ -98,7 +113,7 @@ test_server() { run_client() { cd "./client/" || fail # Use tee to make react-scripts thinks it's not an interactive console - npm run start | tee + npm run start | tee || fail } # ----------------------------------------------------------------------------- @@ -106,7 +121,7 @@ run_client() { # ----------------------------------------------------------------------------- if [ -z "$1" ]; then - echo "$HELP" + colored_echo "$HELP" exit 0 fi @@ -118,6 +133,11 @@ case "$1" in run_server & run_client & + colored_echo "" + colored_echo "----------------------------------------------------" + colored_echo " Press ctrc+c to stop everything" + colored_echo "----------------------------------------------------" + trap stop_docker SIGINT # Stop docker on ctrl+c wait # Do not stop the script until the commands are finished @@ -139,13 +159,13 @@ case "$1" in ;; "nuke") - read -p "Do you want to remove all your development data (including database)? [yN] " -n 1 -r - echo # newline + read -p "Do you want to remove all your development data (including databases)? [yN] " -n 1 -r + colored_echo # newline if [[ "$REPLY" =~ ^[YyOo]$ ]]; then $DC down --volumes - echo "Removing client/node_modules" && rm -rf client/node_modules - echo "Removing server/node_modules" && rm -rf server/node_modules - echo "Removing dev.env" && rm -r dev.env + colored_echo "Removing client/node_modules" && rm -rf client/node_modules + colored_echo "Removing server/node_modules" && rm -rf server/node_modules + colored_echo "Removing dev.env" && rm -r dev.env fi exit 0 ;; From e89961a2170cd49ae102362e4ea2543259e27eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 16:00:53 +0100 Subject: [PATCH 34/44] chore: add dev-env command to create user --- dev-env.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index 1df2ddb0..8e9ae8bf 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -6,6 +6,7 @@ Available commands: - stop-docker: Stop docker containers - test: Launch unit tests - nuke: Remove all developement data + - create-user : Create a new user in the database and LDAP " DC="docker compose --file docker-compose.dev.yml" @@ -25,7 +26,7 @@ fail() { colored_echo() { GREEN="\e[42m" DEFAULT="\e[0m" - echo -e "${GREEN}${1}${DEFAULT}" + echo -e "${GREEN}[dev-env.sh] ${1}${DEFAULT}" } check_system_dependencies() { @@ -49,10 +50,9 @@ check_system_dependencies() { # fi if ! [ -f "dev.env" ]; then - colored_echo "Missing dev.env file, creating with default values from .env.example" - colored_echo "Feel free to edit your local .env to match your dev environment" + colored_echo " Missing dev.env file, creating with default values from .env.example" + colored_echo " Feel free to edit your local .env to match your dev environment" cp ".env.example" "dev.env" || fail - colored_echo fi colored_echo "...OK!" @@ -100,7 +100,7 @@ test_server() { sleep 2 done - # shellcheck disable=SC2046 # We want the attributes to be treated separately + # shellcheck disable=SC2046 # We want the attributes to be treated separately export $(grep --only-matching "APOTHIQUIZ_.*=[^ ]*" dev.env | xargs) export APOTHIQUIZ_DB_PORT=3307 # 3307 is the port for the test database cd "./server/" || fail @@ -116,6 +116,37 @@ run_client() { npm run start | tee || fail } +create_user() { + # default password is "password" + USERID="$1" + + colored_echo "Create new user: '$USERID'" + + colored_echo " [1/2] Adding to LDAP database" + cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ + dn: uid=$USERID,ou=users,dc=apothiquiz,dc=io + uid: $USERID + cn: $USERID + sn: 3 + objectClass: top + objectClass: posixAccount + objectClass: inetOrgPerson + loginShell: /bin/bash + homeDirectory: /home/$USERID + uidNumber: 14583102 + gidNumber: 14564100 + userPassword: {SSHA}qgUzqcueyWA927ttHMnXP89MSL/rP8CR + mail: $USERID@example.org + gecos: $USERID UserEOF + EOF + + colored_echo " [2/2] Adding to mariadb database" + echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',0)" | + docker compose --file docker-compose.dev.yml exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb + + colored_echo "User $USERID created successfully, the default password is 'password'" +} + # ----------------------------------------------------------------------------- # ACTUAL SCRIPT # ----------------------------------------------------------------------------- @@ -133,10 +164,11 @@ case "$1" in run_server & run_client & - colored_echo "" + echo "" colored_echo "----------------------------------------------------" colored_echo " Press ctrc+c to stop everything" colored_echo "----------------------------------------------------" + echo "" trap stop_docker SIGINT # Stop docker on ctrl+c @@ -160,7 +192,7 @@ case "$1" in "nuke") read -p "Do you want to remove all your development data (including databases)? [yN] " -n 1 -r - colored_echo # newline + echo # newline if [[ "$REPLY" =~ ^[YyOo]$ ]]; then $DC down --volumes colored_echo "Removing client/node_modules" && rm -rf client/node_modules @@ -170,7 +202,16 @@ case "$1" in exit 0 ;; -"help"|*) +"create-user") + if [ -z "$2" ]; then + colored_echo "Il manque le nom d'utilisateur" + exit 1 + fi + create_user "$2" + exit 0 + ;; + +"help" | *) echo "$HELP" exit 0 ;; From 40fc823678c737801ebee2b7210a5068f9d2ddac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 16:07:02 +0100 Subject: [PATCH 35/44] chore: dev-env trap sigint sooner --- dev-env.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index 8e9ae8bf..c004da9a 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -160,6 +160,7 @@ case "$1" in "start") check_system_dependencies check_npm_dependencies + trap stop_docker SIGINT # Stop docker on ctrl+c start_docker run_server & run_client & @@ -170,8 +171,6 @@ case "$1" in colored_echo "----------------------------------------------------" echo "" - trap stop_docker SIGINT # Stop docker on ctrl+c - wait # Do not stop the script until the commands are finished exit 0 ;; From 36ab12db667369d2721a1c3763ff36eb90466ca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 16:09:47 +0100 Subject: [PATCH 36/44] docs: better padding --- dev-env.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index c004da9a..8b8d4018 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -50,8 +50,8 @@ check_system_dependencies() { # fi if ! [ -f "dev.env" ]; then - colored_echo " Missing dev.env file, creating with default values from .env.example" - colored_echo " Feel free to edit your local .env to match your dev environment" + colored_echo " Missing dev.env file, creating with default values from .env.example" + colored_echo " Feel free to edit your local .env to match your dev environment" cp ".env.example" "dev.env" || fail fi @@ -63,7 +63,7 @@ check_npm_dependencies() { for DIR in "client" "server"; do cd "$DIR" || fail if ! [ -d "node_modules" ] || ! npm list --all >/dev/null 2>&1; then - colored_echo "Installing npm dependencies in $DIR" + colored_echo " Installing npm dependencies in $DIR" npm install fi @@ -122,7 +122,7 @@ create_user() { colored_echo "Create new user: '$USERID'" - colored_echo " [1/2] Adding to LDAP database" + colored_echo " [1/2] Adding to LDAP database" cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ dn: uid=$USERID,ou=users,dc=apothiquiz,dc=io uid: $USERID @@ -140,7 +140,7 @@ create_user() { gecos: $USERID UserEOF EOF - colored_echo " [2/2] Adding to mariadb database" + colored_echo " [2/2] Adding to mariadb database" echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',0)" | docker compose --file docker-compose.dev.yml exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb From 0f9ae273afd22566375a58d8e79600eb3802eee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:06:00 +0100 Subject: [PATCH 37/44] fix: somes changes at right and left --- .github/workflows/node.js.yml | 4 +- client/package-lock.json | 1103 ++++++++++++------ dev-env.sh | 85 +- docker-compose.dev.yml => docker-compose.yml | 10 + 4 files changed, 820 insertions(+), 382 deletions(-) rename docker-compose.dev.yml => docker-compose.yml (88%) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index c2a2e05a..872e8f34 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - uses: actions/checkout@v2 @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - node-version: [14.x] + node-version: [16.x] env: APOTHIQUIZ_ACCESS_TOKEN_KEY: TMP_ACCESS_KEY diff --git a/client/package-lock.json b/client/package-lock.json index 885fda39..b6f6a04f 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -45,40 +45,57 @@ "sinon-chai": "^3.5.0" } }, + "node_modules/@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dependencies": { - "@babel/highlight": "^7.12.13" + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.12.tgz", - "integrity": "sha512-3eJJ841uKxeV8dcN/2yGEUy+RfgQspPEgQat85umsE1rotuquQ2AbIub4S6j7c50a2d+4myc+zSlnXeIHrOnhQ==" + "version": "7.20.14", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", + "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==", + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/core": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", - "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", - "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.1", - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helpers": "^7.12.1", - "@babel/parser": "^7.12.3", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1", + "version": "7.20.12", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", + "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", + "dependencies": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.7", + "@babel/helper-compilation-targets": "^7.20.7", + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helpers": "^7.20.7", + "@babel/parser": "^7.20.7", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.12", + "@babel/types": "^7.20.7", "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -88,30 +105,38 @@ "url": "https://opencollective.com/babel" } }, - "node_modules/@babel/core/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "engines": { - "node": ">=0.10.0" + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" } }, "node_modules/@babel/generator": { - "version": "7.13.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz", - "integrity": "sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==", + "version": "7.20.14", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.14.tgz", + "integrity": "sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg==", "dependencies": { - "@babel/types": "^7.13.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/types": "^7.20.7", + "@jridgewell/gen-mapping": "^0.3.2", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" } }, - "node_modules/@babel/generator/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, "node_modules/@babel/helper-annotate-as-pure": { @@ -132,19 +157,31 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.13.tgz", - "integrity": "sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", + "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", "dependencies": { - "@babel/compat-data": "^7.13.12", - "@babel/helper-validator-option": "^7.12.17", - "browserslist": "^4.14.5", + "@babel/compat-data": "^7.20.5", + "@babel/helper-validator-option": "^7.18.6", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", "semver": "^6.3.0" }, + "engines": { + "node": ">=6.9.0" + }, "peerDependencies": { "@babel/core": "^7.0.0" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": { + "yallist": "^3.0.2" + } + }, "node_modules/@babel/helper-compilation-targets/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -153,6 +190,11 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, "node_modules/@babel/helper-create-class-features-plugin": { "version": "7.13.11", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.11.tgz", @@ -206,6 +248,14 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-explode-assignable-expression": { "version": "7.13.0", "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz", @@ -215,30 +265,26 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz", - "integrity": "sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", + "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", "dependencies": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", - "dependencies": { - "@babel/types": "^7.12.13" + "@babel/template": "^7.18.10", + "@babel/types": "^7.19.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.0.tgz", - "integrity": "sha512-0kBzvXiIKfsCA0y6cFEIJf4OdzfpRuNk4+YTeHZpGGc666SATFKTz6sRncwFnQk7/ugJ4dSrCj6iJuvW4Qwr2g==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "dependencies": { - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { @@ -250,26 +296,32 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", - "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", + "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", "dependencies": { - "@babel/types": "^7.13.12" + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.13.14", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.13.14.tgz", - "integrity": "sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", + "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", "dependencies": { - "@babel/helper-module-imports": "^7.13.12", - "@babel/helper-replace-supers": "^7.13.12", - "@babel/helper-simple-access": "^7.13.12", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/helper-validator-identifier": "^7.12.11", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.13", - "@babel/types": "^7.13.14" + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.10", + "@babel/types": "^7.20.7" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-optimise-call-expression": { @@ -307,11 +359,14 @@ } }, "node_modules/@babel/helper-simple-access": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", - "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dependencies": { - "@babel/types": "^7.13.12" + "@babel/types": "^7.20.2" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { @@ -323,22 +378,39 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "dependencies": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helper-validator-option": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", - "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==" + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", + "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", + "engines": { + "node": ">=6.9.0" + } }, "node_modules/@babel/helper-wrap-function": { "version": "7.13.0", @@ -352,29 +424,35 @@ } }, "node_modules/@babel/helpers": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.13.10.tgz", - "integrity": "sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ==", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", + "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", "dependencies": { - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.13", + "@babel/types": "^7.20.7" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", - "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dependencies": { - "@babel/helper-validator-identifier": "^7.12.11", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.13.tgz", - "integrity": "sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw==", + "version": "7.20.15", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.15.tgz", + "integrity": "sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1415,38 +1493,49 @@ } }, "node_modules/@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.13.13.tgz", - "integrity": "sha512-CblEcwmXKR6eP43oQGG++0QMTtCjAsa3frUuzHoiIJWpaIIi8dwMyEFUJoXRLxagGqCK+jALRwIO+o3R9p/uUg==", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.9", - "@babel/helper-function-name": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.13.13", - "@babel/types": "^7.13.13", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.13.tgz", + "integrity": "sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ==", + "dependencies": { + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.7", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.19.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.20.13", + "@babel/types": "^7.20.7", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/types": { - "version": "7.13.14", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.14.tgz", - "integrity": "sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", + "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", "dependencies": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@bcoe/v8-coverage": { @@ -2649,6 +2738,48 @@ "node": ">= 6" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "dependencies": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, "node_modules/@modulz/radix-icons": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@modulz/radix-icons/-/radix-icons-3.3.0.tgz", @@ -2716,6 +2847,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.1.2.tgz", "integrity": "sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==", + "deprecated": "This functionality has been moved to @npmcli/fs", "dependencies": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" @@ -4306,7 +4438,7 @@ "node_modules/amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", "optional": true, "peer": true, "engines": { @@ -5211,6 +5343,36 @@ "babel-plugin-transform-react-remove-prop-types": "0.4.24" } }, + "node_modules/babel-preset-react-app/node_modules/@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, "node_modules/babel-preset-react-app/node_modules/@babel/plugin-proposal-class-properties": { "version": "7.12.1", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz", @@ -5372,6 +5534,14 @@ "regenerator-runtime": "^0.13.4" } }, + "node_modules/babel-preset-react-app/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -5385,7 +5555,7 @@ "version": "2.6.12", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", "hasInstallScript": true }, "node_modules/babel-runtime/node_modules/regenerator-runtime": { @@ -5540,6 +5710,15 @@ "node": ">=8" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -5775,31 +5954,36 @@ } }, "node_modules/browserslist": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.0.tgz", - "integrity": "sha512-bnpOoa+DownbciXj0jVGENf8VYQnE2LNWomhYuCsMmmx9Jd9lwq0WXODuwpSsp8AVdKM2/HorrzxAfbKvWTByQ==", + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], "dependencies": { - "caniuse-lite": "^1.0.30001313", - "electron-to-chromium": "^1.4.76", - "escalade": "^3.1.1", - "node-releases": "^2.0.2", - "picocolors": "^1.0.0" + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" } }, "node_modules/browserslist/node_modules/node-releases": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.2.tgz", - "integrity": "sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==" + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" }, "node_modules/bser": { "version": "2.1.1", @@ -6030,13 +6214,19 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001315", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001315.tgz", - "integrity": "sha512-5v7LFQU4Sb/qvkz7JcZkvtSH1Ko+1x2kgo3ocdBeMGZSOFpuE1kkm0kpTwLtWeFrw5qw08ulLxJjVIXIS8MkiQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } + "version": "1.0.30001456", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz", + "integrity": "sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] }, "node_modules/capture-exit": { "version": "2.0.0", @@ -6539,7 +6729,7 @@ "node_modules/code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", "optional": true, "peer": true, "engines": { @@ -6813,6 +7003,7 @@ "version": "3.10.0", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.10.0.tgz", "integrity": "sha512-MQx/7TLgmmDVamSyfE+O+5BHvG1aUGj/gHhLn1wVtm2B5u1eVIPvh7vkfjwWKNCjrTJB8+He99IntSQ1qP+vYQ==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -6844,6 +7035,7 @@ "version": "3.10.0", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.10.0.tgz", "integrity": "sha512-CC582enhrFZStO4F8lGI7QL3SYx7/AIRc+IdSi3btrQGrVsTawo5K/crmKbRrQ+MOMhNX4v+PATn0k2NN6wI7A==", + "deprecated": "core-js-pure@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -8036,9 +8228,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.82", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.82.tgz", - "integrity": "sha512-Ks+ANzLoIrFDUOJdjxYMH6CMKB8UQo5modAwvSZTxgF+vEs/U7G5IbWFUp6dS4klPkTDVdxbORuk8xAXXhMsWw==" + "version": "1.4.301", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.301.tgz", + "integrity": "sha512-bz00ASIIDjcgszZKuEA1JEFhbDjqUNbQ/PEhNEl1wbixzYpeTp2H2QWjsQvAL2T1wJBdOwCF5hE896BoMwYKrA==" }, "node_modules/elliptic": { "version": "6.5.4", @@ -10014,6 +10206,12 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "node_modules/filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -15670,12 +15868,9 @@ "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==" }, "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "dependencies": { - "minimist": "^1.2.5" - }, + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "bin": { "json5": "lib/cli.js" }, @@ -16302,6 +16497,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", "integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "dependencies": { "@babel/runtime": "^7.12.1", "tiny-warning": "^1.0.3" @@ -17184,7 +17380,7 @@ "node_modules/number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "optional": true, "peer": true, "engines": { @@ -19818,6 +20014,52 @@ } } }, + "node_modules/react-scripts/node_modules/@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/react-scripts/node_modules/@babel/core/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/react-scripts/node_modules/@babel/core/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-scripts/node_modules/ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -20827,6 +21069,7 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.3.1.tgz", "integrity": "sha512-1pkwkervMJQGFYvM9nscrUoncPwiKR/K+bHdjv6PFgRo3cgPHoRT83y2Aa3GvINj4539S15t/tpFPb775TDs6w==", + "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser", "dependencies": { "@babel/code-frame": "^7.5.5", "jest-worker": "^24.9.0", @@ -21905,6 +22148,7 @@ "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", "dependencies": { "atob": "^2.1.2", "decode-uri-component": "^0.2.0", @@ -21925,12 +22169,14 @@ "node_modules/source-map-url": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", - "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==" + "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", + "deprecated": "See https://github.com/lydell/source-map-url#deprecated" }, "node_modules/sourcemap-codec": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead" }, "node_modules/spdx-correct": { "version": "3.1.1", @@ -22055,7 +22301,8 @@ "node_modules/stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "deprecated": "Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility" }, "node_modules/stack-utils": { "version": "2.0.3", @@ -23085,19 +23332,6 @@ "node": ">=4" } }, - "node_modules/type-fest": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", - "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "optional": true, - "peer": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -23123,6 +23357,19 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/unbox-primitive": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", @@ -23307,6 +23554,31 @@ "yarn": "*" } }, + "node_modules/update-browserslist-db": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist-lint": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -23548,6 +23820,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", + "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", "dependencies": { "browser-process-hrtime": "^1.0.0" } @@ -23666,7 +23939,7 @@ "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.", + "deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies", "optional": true, "dependencies": { "anymatch": "^2.0.0", @@ -24049,7 +24322,7 @@ "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.", + "deprecated": "Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies", "dependencies": { "anymatch": "^2.0.0", "async-each": "^1.0.1", @@ -25154,63 +25427,76 @@ } }, "dependencies": { + "@ampproject/remapping": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", + "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", + "requires": { + "@jridgewell/gen-mapping": "^0.1.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, "@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "requires": { - "@babel/highlight": "^7.12.13" + "@babel/highlight": "^7.18.6" } }, "@babel/compat-data": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.13.12.tgz", - "integrity": "sha512-3eJJ841uKxeV8dcN/2yGEUy+RfgQspPEgQat85umsE1rotuquQ2AbIub4S6j7c50a2d+4myc+zSlnXeIHrOnhQ==" + "version": "7.20.14", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.14.tgz", + "integrity": "sha512-0YpKHD6ImkWMEINCyDAD0HLLUH/lPCefG8ld9it8DJB2wnApraKuhgYTvTY1z7UFIfBTGy5LwncZ+5HWWGbhFw==" }, "@babel/core": { - "version": "7.12.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", - "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", - "requires": { - "@babel/code-frame": "^7.10.4", - "@babel/generator": "^7.12.1", - "@babel/helper-module-transforms": "^7.12.1", - "@babel/helpers": "^7.12.1", - "@babel/parser": "^7.12.3", - "@babel/template": "^7.10.4", - "@babel/traverse": "^7.12.1", - "@babel/types": "^7.12.1", + "version": "7.20.12", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.12.tgz", + "integrity": "sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==", + "requires": { + "@ampproject/remapping": "^2.1.0", + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.7", + "@babel/helper-compilation-targets": "^7.20.7", + "@babel/helper-module-transforms": "^7.20.11", + "@babel/helpers": "^7.20.7", + "@babel/parser": "^7.20.7", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.12", + "@babel/types": "^7.20.7", "convert-source-map": "^1.7.0", "debug": "^4.1.0", - "gensync": "^1.0.0-beta.1", - "json5": "^2.1.2", - "lodash": "^4.17.19", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.2", + "semver": "^6.3.0" }, "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, "@babel/generator": { - "version": "7.13.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.13.9.tgz", - "integrity": "sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw==", + "version": "7.20.14", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.14.tgz", + "integrity": "sha512-AEmuXHdcD3A52HHXxaTmYlb8q/xMEhoRP67B3T4Oq7lbmSoqroMZzjnGj3+i1io3pdnF8iBYVu4Ilj+c4hBxYg==", "requires": { - "@babel/types": "^7.13.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/types": "^7.20.7", + "@jridgewell/gen-mapping": "^0.3.2", + "jsesc": "^2.5.1" }, "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } } } }, @@ -25232,20 +25518,34 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.13.tgz", - "integrity": "sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz", + "integrity": "sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==", "requires": { - "@babel/compat-data": "^7.13.12", - "@babel/helper-validator-option": "^7.12.17", - "browserslist": "^4.14.5", + "@babel/compat-data": "^7.20.5", + "@babel/helper-validator-option": "^7.18.6", + "browserslist": "^4.21.3", + "lru-cache": "^5.1.1", "semver": "^6.3.0" }, "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" } } }, @@ -25292,6 +25592,11 @@ } } }, + "@babel/helper-environment-visitor": { + "version": "7.18.9", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", + "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==" + }, "@babel/helper-explode-assignable-expression": { "version": "7.13.0", "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.13.0.tgz", @@ -25301,30 +25606,20 @@ } }, "@babel/helper-function-name": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz", - "integrity": "sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA==", - "requires": { - "@babel/helper-get-function-arity": "^7.12.13", - "@babel/template": "^7.12.13", - "@babel/types": "^7.12.13" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz", - "integrity": "sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg==", + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", + "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", "requires": { - "@babel/types": "^7.12.13" + "@babel/template": "^7.18.10", + "@babel/types": "^7.19.0" } }, "@babel/helper-hoist-variables": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.13.0.tgz", - "integrity": "sha512-0kBzvXiIKfsCA0y6cFEIJf4OdzfpRuNk4+YTeHZpGGc666SATFKTz6sRncwFnQk7/ugJ4dSrCj6iJuvW4Qwr2g==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", + "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", "requires": { - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" + "@babel/types": "^7.18.6" } }, "@babel/helper-member-expression-to-functions": { @@ -25336,26 +25631,26 @@ } }, "@babel/helper-module-imports": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz", - "integrity": "sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", + "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", "requires": { - "@babel/types": "^7.13.12" + "@babel/types": "^7.18.6" } }, "@babel/helper-module-transforms": { - "version": "7.13.14", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.13.14.tgz", - "integrity": "sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g==", + "version": "7.20.11", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz", + "integrity": "sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==", "requires": { - "@babel/helper-module-imports": "^7.13.12", - "@babel/helper-replace-supers": "^7.13.12", - "@babel/helper-simple-access": "^7.13.12", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/helper-validator-identifier": "^7.12.11", - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.13", - "@babel/types": "^7.13.14" + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-module-imports": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.10", + "@babel/types": "^7.20.7" } }, "@babel/helper-optimise-call-expression": { @@ -25393,11 +25688,11 @@ } }, "@babel/helper-simple-access": { - "version": "7.13.12", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz", - "integrity": "sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "requires": { - "@babel/types": "^7.13.12" + "@babel/types": "^7.20.2" } }, "@babel/helper-skip-transparent-expression-wrappers": { @@ -25409,22 +25704,27 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz", - "integrity": "sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", + "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", "requires": { - "@babel/types": "^7.12.13" + "@babel/types": "^7.18.6" } }, + "@babel/helper-string-parser": { + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==" + }, "@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==" }, "@babel/helper-validator-option": { - "version": "7.12.17", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz", - "integrity": "sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw==" + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", + "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==" }, "@babel/helper-wrap-function": { "version": "7.13.0", @@ -25438,29 +25738,29 @@ } }, "@babel/helpers": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.13.10.tgz", - "integrity": "sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ==", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.13.tgz", + "integrity": "sha512-nzJ0DWCL3gB5RCXbUO3KIMMsBY2Eqbx8mBpKGE/02PgyRQFcPQLbkQ1vyy596mZLaP+dAfD+R4ckASzNVmW3jg==", "requires": { - "@babel/template": "^7.12.13", - "@babel/traverse": "^7.13.0", - "@babel/types": "^7.13.0" + "@babel/template": "^7.20.7", + "@babel/traverse": "^7.20.13", + "@babel/types": "^7.20.7" } }, "@babel/highlight": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", - "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "requires": { - "@babel/helper-validator-identifier": "^7.12.11", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" } }, "@babel/parser": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.13.tgz", - "integrity": "sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw==" + "version": "7.20.15", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.15.tgz", + "integrity": "sha512-DI4a1oZuf8wC+oAJA9RW6ga3Zbe8RZFt7kD9i4qAspz3I/yHet1VvC3DiSy/fsUvv5pvJuNPh0LPOdCcqinDPg==" }, "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "version": "7.13.12", @@ -26254,37 +26554,39 @@ } }, "@babel/template": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.12.13.tgz", - "integrity": "sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", + "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/parser": "^7.12.13", - "@babel/types": "^7.12.13" + "@babel/code-frame": "^7.18.6", + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7" } }, "@babel/traverse": { - "version": "7.13.13", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.13.13.tgz", - "integrity": "sha512-CblEcwmXKR6eP43oQGG++0QMTtCjAsa3frUuzHoiIJWpaIIi8dwMyEFUJoXRLxagGqCK+jALRwIO+o3R9p/uUg==", - "requires": { - "@babel/code-frame": "^7.12.13", - "@babel/generator": "^7.13.9", - "@babel/helper-function-name": "^7.12.13", - "@babel/helper-split-export-declaration": "^7.12.13", - "@babel/parser": "^7.13.13", - "@babel/types": "^7.13.13", + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.13.tgz", + "integrity": "sha512-kMJXfF0T6DIS9E8cgdLCSAL+cuCK+YEZHWiLK0SXpTo8YRj5lpJu3CDNKiIBCne4m9hhTIqUg6SYTAI39tAiVQ==", + "requires": { + "@babel/code-frame": "^7.18.6", + "@babel/generator": "^7.20.7", + "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-function-name": "^7.19.0", + "@babel/helper-hoist-variables": "^7.18.6", + "@babel/helper-split-export-declaration": "^7.18.6", + "@babel/parser": "^7.20.13", + "@babel/types": "^7.20.7", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.13.14", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.14.tgz", - "integrity": "sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ==", + "version": "7.20.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz", + "integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==", "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "lodash": "^4.17.19", + "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" } }, @@ -27225,6 +27527,39 @@ "@types/yargs": "^13.0.0" } }, + "@jridgewell/gen-mapping": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", + "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", + "requires": { + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==" + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "@jridgewell/trace-mapping": { + "version": "0.3.17", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz", + "integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==", + "requires": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, "@modulz/radix-icons": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@modulz/radix-icons/-/radix-icons-3.3.0.tgz", @@ -28483,7 +28818,7 @@ "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", "optional": true, "peer": true }, @@ -29180,6 +29515,29 @@ "babel-plugin-transform-react-remove-prop-types": "0.4.24" }, "dependencies": { + "@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + } + }, "@babel/plugin-proposal-class-properties": { "version": "7.12.1", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.12.1.tgz", @@ -29319,6 +29677,11 @@ "requires": { "regenerator-runtime": "^0.13.4" } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==" } } }, @@ -29448,6 +29811,15 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "optional": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -29654,21 +30026,20 @@ } }, "browserslist": { - "version": "4.20.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.0.tgz", - "integrity": "sha512-bnpOoa+DownbciXj0jVGENf8VYQnE2LNWomhYuCsMmmx9Jd9lwq0WXODuwpSsp8AVdKM2/HorrzxAfbKvWTByQ==", + "version": "4.21.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.5.tgz", + "integrity": "sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==", "requires": { - "caniuse-lite": "^1.0.30001313", - "electron-to-chromium": "^1.4.76", - "escalade": "^3.1.1", - "node-releases": "^2.0.2", - "picocolors": "^1.0.0" + "caniuse-lite": "^1.0.30001449", + "electron-to-chromium": "^1.4.284", + "node-releases": "^2.0.8", + "update-browserslist-db": "^1.0.10" }, "dependencies": { "node-releases": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.2.tgz", - "integrity": "sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==" + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", + "integrity": "sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==" } } }, @@ -29856,9 +30227,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001315", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001315.tgz", - "integrity": "sha512-5v7LFQU4Sb/qvkz7JcZkvtSH1Ko+1x2kgo3ocdBeMGZSOFpuE1kkm0kpTwLtWeFrw5qw08ulLxJjVIXIS8MkiQ==" + "version": "1.0.30001456", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001456.tgz", + "integrity": "sha512-XFHJY5dUgmpMV25UqaD4kVq2LsiaU5rS8fb0f17pCoXQiQslzmFgnfOxfvo1bTpTqf7dwG/N/05CnLCnOEKmzA==" }, "capture-exit": { "version": "2.0.0", @@ -30248,7 +30619,7 @@ "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", "optional": true, "peer": true }, @@ -31442,9 +31813,9 @@ "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==" }, "electron-to-chromium": { - "version": "1.4.82", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.82.tgz", - "integrity": "sha512-Ks+ANzLoIrFDUOJdjxYMH6CMKB8UQo5modAwvSZTxgF+vEs/U7G5IbWFUp6dS4klPkTDVdxbORuk8xAXXhMsWw==" + "version": "1.4.301", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.301.tgz", + "integrity": "sha512-bz00ASIIDjcgszZKuEA1JEFhbDjqUNbQ/PEhNEl1wbixzYpeTp2H2QWjsQvAL2T1wJBdOwCF5hE896BoMwYKrA==" }, "elliptic": { "version": "6.5.4", @@ -32938,6 +33309,12 @@ } } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.1.0.tgz", @@ -37249,12 +37626,9 @@ "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==" }, "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "requires": { - "minimist": "^1.2.5" - } + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" }, "jsonfile": { "version": "6.1.0", @@ -38455,7 +38829,7 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "optional": true, "peer": true }, @@ -40545,6 +40919,41 @@ "workbox-webpack-plugin": "5.1.4" }, "dependencies": { + "@babel/core": { + "version": "7.12.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.3.tgz", + "integrity": "sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g==", + "requires": { + "@babel/code-frame": "^7.10.4", + "@babel/generator": "^7.12.1", + "@babel/helper-module-transforms": "^7.12.1", + "@babel/helpers": "^7.12.1", + "@babel/parser": "^7.12.3", + "@babel/template": "^7.10.4", + "@babel/traverse": "^7.12.1", + "@babel/types": "^7.12.1", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.19", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==" + } + } + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -43116,13 +43525,6 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, - "type-fest": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", - "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "optional": true, - "peer": true - }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -43145,6 +43547,12 @@ "is-typedarray": "^1.0.0" } }, + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "peer": true + }, "unbox-primitive": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", @@ -43290,6 +43698,15 @@ "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==" }, + "update-browserslist-db": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", + "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/dev-env.sh b/dev-env.sh index 8b8d4018..d5e1fee2 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -3,12 +3,14 @@ HELP="Setup script for Apothiquiz dev environment Available commands: - start: Start docker containers and run server and client in watch mode - - stop-docker: Stop docker containers - test: Launch unit tests - - nuke: Remove all developement data - create-user : Create a new user in the database and LDAP + + - start-docker: Start docker containers + - stop-docker: Stop docker containers + - nuke: Remove all developement data " -DC="docker compose --file docker-compose.dev.yml" +DC="docker compose" set -e set -o pipefail @@ -18,7 +20,7 @@ set -o pipefail # ----------------------------------------------------------------------------- fail() { echo "Error. Exiting." - stop_docker + # stop_docker_services echo "Exited because of an error." exit 1 } @@ -33,7 +35,7 @@ check_system_dependencies() { HELP_MESSAGE="Please refer to the developer documentation to find how to install the required dependencies: https://github.com/ValFraNath/apothiquiz/wiki/Developer-setup." colored_echo "Checking system dependencies..." - DEPS=("node" "npm" "docker") + DEPS=("docker") for DEP in "${DEPS[@]}"; do if ! command -v "$DEP" >/dev/null 2>&1; then @@ -55,25 +57,25 @@ check_system_dependencies() { cp ".env.example" "dev.env" || fail fi + colored_echo " Pulling missing docker containers." + $DC pull || fail + colored_echo "...OK!" } check_npm_dependencies() { colored_echo "Checking npm dependencies..." for DIR in "client" "server"; do - cd "$DIR" || fail - if ! [ -d "node_modules" ] || ! npm list --all >/dev/null 2>&1; then + if ! [ -d "node_modules" ] || ! $DC exec --workdir "/app/$DIR" node npm list --all >/dev/null 2>&1; then colored_echo " Installing npm dependencies in $DIR" - npm install + $DC exec --workdir "/app/$DIR" node npm install || fail fi - - cd - >/dev/null || fail done colored_echo "...OK!" } -SERVICES=("mariadb" "openldap" "phpldapadmin") -start_docker() { +SERVICES=("mariadb" "openldap" "phpldapadmin" "node") +start_docker_services() { $DC up "${SERVICES[@]}" --detach || fail until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q mariadb)")" == "healthy" ]; do @@ -82,13 +84,18 @@ start_docker() { done } -stop_docker() { +stop_docker_services() { $DC stop "${SERVICES[@]}" } run_server() { - cd "./server/" || fail - npm run start:watch -- --config="../dev.env" || fail + colored_echo "Starting server in watch mode" + $DC exec --workdir "/app/server" --no-TTY node npm run start:watch -- --config="../dev.env" || fail +} + +run_client() { + colored_echo "Starting client in watch mode" + $DC exec --workdir "/app/client" --no-TTY node npm run start | tee || fail } test_server() { @@ -100,30 +107,27 @@ test_server() { sleep 2 done - # shellcheck disable=SC2046 # We want the attributes to be treated separately - export $(grep --only-matching "APOTHIQUIZ_.*=[^ ]*" dev.env | xargs) - export APOTHIQUIZ_DB_PORT=3307 # 3307 is the port for the test database - cd "./server/" || fail - npm run test - - cd "../" || fail - $DC down mariadb-test -} - -run_client() { - cd "./client/" || fail - # Use tee to make react-scripts thinks it's not an interactive console - npm run start | tee || fail + $DC exec --workdir "/app/server" --env APOTHIQUIZ_DB_PORT=3307 node npm run test + $DC stop mariadb-test + $DC rm mariadb-test } create_user() { # default password is "password" USERID="$1" + # Create users group if it doesn't exist + cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ >/dev/null 2>/dev/null || true + dn: ou=users,dc=apothiquiz,dc=io + objectclass: organizationalUnit + objectclass: top + ou: users + EOF + colored_echo "Create new user: '$USERID'" colored_echo " [1/2] Adding to LDAP database" - cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ + cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ || true dn: uid=$USERID,ou=users,dc=apothiquiz,dc=io uid: $USERID cn: $USERID @@ -142,7 +146,7 @@ create_user() { colored_echo " [2/2] Adding to mariadb database" echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',0)" | - docker compose --file docker-compose.dev.yml exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb + $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb colored_echo "User $USERID created successfully, the default password is 'password'" } @@ -159,11 +163,10 @@ fi case "$1" in "start") check_system_dependencies - check_npm_dependencies - trap stop_docker SIGINT # Stop docker on ctrl+c - start_docker - run_server & - run_client & + trap stop_docker_services SIGINT # Stop docker on ctrl+c + start_docker_services + + # check_npm_dependencies echo "" colored_echo "----------------------------------------------------" @@ -171,12 +174,20 @@ case "$1" in colored_echo "----------------------------------------------------" echo "" + run_server & + run_client & + wait # Do not stop the script until the commands are finished exit 0 ;; +"start-docker") + start_docker_services + exit 0 + ;; + "stop-docker") - stop_docker + stop_docker_services exit 0 ;; diff --git a/docker-compose.dev.yml b/docker-compose.yml similarity index 88% rename from docker-compose.dev.yml rename to docker-compose.yml index 921ff425..a18e907d 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.yml @@ -1,6 +1,16 @@ version: "2.4" services: + node: + image: node:16 + env_file: + - dev.env + network_mode: host + volumes: + - .:/app + user: "1000:1000" + command: "sleep infinity" + mariadb: image: mariadb:10.6 volumes: From 98fc5748f22e66d63fb2a94793a181154c8967f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:09:44 +0100 Subject: [PATCH 38/44] chore: updated githooks --- githooks/post-merge.sh | 8 ++++---- githooks/pre-commit.sh | 13 ++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/githooks/post-merge.sh b/githooks/post-merge.sh index 8e3be5b8..ec2025b9 100755 --- a/githooks/post-merge.sh +++ b/githooks/post-merge.sh @@ -1,19 +1,19 @@ #!/bin/bash +docker compose up node --detach + function changed() { git diff --name-only 'HEAD@{1}' HEAD | grep "^$1" >/dev/null 2>&1 } -cd "$(git rev-parse --show-toplevel)/server" || exit 1 if changed 'server/package-lock.json'; then echo "📦 server/package-lock.json changed. Running npm install" - npm install || exit 1 + docker compose exec --workdir "/app/server" --no-TTY node npm install || exit 1 fi -cd "$(git rev-parse --show-toplevel)/client" || exit 1 if changed 'client/package-lock.json'; then echo "📦 client/package-lock.json changed. Running npm install" - npm install || exit 1 + docker compose exec --workdir "/app/client" --no-TTY node npm install || exit 1 fi exit 0 diff --git a/githooks/pre-commit.sh b/githooks/pre-commit.sh index af306dfb..1cfaf38a 100755 --- a/githooks/pre-commit.sh +++ b/githooks/pre-commit.sh @@ -1,18 +1,17 @@ #!/bin/bash +docker compose up node --detach + if [ "$(git diff --name-only HEAD | grep "^server/")" != "" ]; then - cd "$(git rev-parse --show-toplevel)/server" || exit 1 echo "Linting and formatting server files" - npm run format:write || exit 1 - npm run lint:fix -- --max-warnings 0 || exit 1 + docker compose exec --workdir "/app/server" --no-TTY node npm run format:write || exit 1 + docker compose exec --workdir "/app/server" --no-TTY node npm run lint:fix -- --max-warnings 0 || exit 1 fi if [ "$(git diff --name-only HEAD | grep "^client/")" != "" ]; then - cd "$(git rev-parse --show-toplevel)/client" || exit 1 echo "Linting and formatting client files" - npm run format:write || exit 1 - npm run lint:fix -- --max-warnings 0 || exit 1 + docker compose exec --workdir "/app/client" --no-TTY node npm run format:write || exit 1 + docker compose exec --workdir "/app/client" --no-TTY node npm run lint:fix -- --max-warnings 0 || exit 1 fi -cd "$(git rev-parse --show-toplevel)" || exit 1 exit 0 From bfa021c462ad7b26f565a3642c2541659681aa1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:12:31 +0100 Subject: [PATCH 39/44] feat: choose password on cli --- dev-env.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index d5e1fee2..50d59092 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -4,7 +4,7 @@ HELP="Setup script for Apothiquiz dev environment Available commands: - start: Start docker containers and run server and client in watch mode - test: Launch unit tests - - create-user : Create a new user in the database and LDAP + - create-user [password]: Create a new user in the database and LDAP - start-docker: Start docker containers - stop-docker: Stop docker containers @@ -115,6 +115,7 @@ test_server() { create_user() { # default password is "password" USERID="$1" + PASSWORD="${2:-"password"}" # Create users group if it doesn't exist cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ >/dev/null 2>/dev/null || true @@ -139,7 +140,7 @@ create_user() { homeDirectory: /home/$USERID uidNumber: 14583102 gidNumber: 14564100 - userPassword: {SSHA}qgUzqcueyWA927ttHMnXP89MSL/rP8CR + userPassword: $PASSWORD mail: $USERID@example.org gecos: $USERID UserEOF EOF @@ -148,7 +149,7 @@ create_user() { echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',0)" | $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb - colored_echo "User $USERID created successfully, the default password is 'password'" + colored_echo "User $USERID created successfully, the default password is '$PASSWORD'" } # ----------------------------------------------------------------------------- @@ -217,7 +218,7 @@ case "$1" in colored_echo "Il manque le nom d'utilisateur" exit 1 fi - create_user "$2" + create_user "$2" "$3" exit 0 ;; From c6fa8f9c4bdf8eb49ae97175f756dfdd703a94fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:14:42 +0100 Subject: [PATCH 40/44] fix: bring back check_npm_deps --- dev-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-env.sh b/dev-env.sh index 50d59092..c9311efa 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -167,7 +167,7 @@ case "$1" in trap stop_docker_services SIGINT # Stop docker on ctrl+c start_docker_services - # check_npm_dependencies + check_npm_dependencies echo "" colored_echo "----------------------------------------------------" From 70035b4bfb15c2f4c6368953aa96378508d55506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:24:14 +0100 Subject: [PATCH 41/44] feat: allow to create admin user --- dev-env.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index c9311efa..bb90fafd 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -4,7 +4,7 @@ HELP="Setup script for Apothiquiz dev environment Available commands: - start: Start docker containers and run server and client in watch mode - test: Launch unit tests - - create-user [password]: Create a new user in the database and LDAP + - create-user [password] [is-admin]: Create a new user in the database and LDAP - start-docker: Start docker containers - stop-docker: Stop docker containers @@ -116,6 +116,7 @@ create_user() { # default password is "password" USERID="$1" PASSWORD="${2:-"password"}" + [[ -z "$3" ]] && IS_ADMIN="0" || IS_ADMIN="1" # Create users group if it doesn't exist cat <<-EOF | $DC exec --no-TTY openldap ldapadd -x -D "cn=admin,dc=apothiquiz,dc=io" -w password -H ldap://localhost -ZZ >/dev/null 2>/dev/null || true @@ -146,7 +147,7 @@ create_user() { EOF colored_echo " [2/2] Adding to mariadb database" - echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',0)" | + echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',$IS_ADMIN)" | $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb colored_echo "User $USERID created successfully, the default password is '$PASSWORD'" @@ -218,7 +219,7 @@ case "$1" in colored_echo "Il manque le nom d'utilisateur" exit 1 fi - create_user "$2" "$3" + create_user "$2" "$3" "$4" exit 0 ;; From 134d153ccade5b97f9e0b6f11d4613da00cc7bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:34:16 +0100 Subject: [PATCH 42/44] feat: add seed command --- dev-env.sh | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index bb90fafd..7169a51a 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -6,6 +6,7 @@ Available commands: - test: Launch unit tests - create-user [password] [is-admin]: Create a new user in the database and LDAP + - seed: Import default molecules and create default users - start-docker: Start docker containers - stop-docker: Stop docker containers - nuke: Remove all developement data @@ -113,7 +114,6 @@ test_server() { } create_user() { - # default password is "password" USERID="$1" PASSWORD="${2:-"password"}" [[ -z "$3" ]] && IS_ADMIN="0" || IS_ADMIN="1" @@ -162,9 +162,10 @@ if [ -z "$1" ]; then exit 0 fi +check_system_dependencies + case "$1" in "start") - check_system_dependencies trap stop_docker_services SIGINT # Stop docker on ctrl+c start_docker_services @@ -183,22 +184,43 @@ case "$1" in exit 0 ;; -"start-docker") + +"test") start_docker_services + check_npm_dependencies + test_server & + + wait + exit 0 + ;; +"create-user") + if [ -z "$2" ]; then + colored_echo "Il manque le nom d'utilisateur" + exit 1 + fi + create_user "$2" "$3" "$4" exit 0 ;; -"stop-docker") - stop_docker_services +"seed") + start_docker_services + + colored_echo "Importing default data for molecules" + $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb < ./server/test/required-data/config.sql || true + $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb < ./server/test/required-data/molecules.sql || true + + create_user "user" "password" "1" + create_user "admin" "password" "1" exit 0 ;; -"test") - check_system_dependencies - check_npm_dependencies - test_server & +"start-docker") + start_docker_services + exit 0 + ;; - wait +"stop-docker") + stop_docker_services exit 0 ;; @@ -214,15 +236,6 @@ case "$1" in exit 0 ;; -"create-user") - if [ -z "$2" ]; then - colored_echo "Il manque le nom d'utilisateur" - exit 1 - fi - create_user "$2" "$3" "$4" - exit 0 - ;; - "help" | *) echo "$HELP" exit 0 From 5259253dc0f369d2b33bbf5b476cf8f902c573a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 17 Feb 2023 17:47:18 +0100 Subject: [PATCH 43/44] fix: dev-env.sh tests --- dev-env.sh | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/dev-env.sh b/dev-env.sh index 7169a51a..cda4ed54 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -1,10 +1,13 @@ #!/bin/bash +GREEN="\e[42m" +RED="\e[41m" +DEFAULT="\e[0m" -HELP="Setup script for Apothiquiz dev environment +HELP="${GREEN}Setup script for Apothiquiz dev environment${DEFAULT} Available commands: - start: Start docker containers and run server and client in watch mode - test: Launch unit tests - - create-user [password] [is-admin]: Create a new user in the database and LDAP + - create-user [password] [isadmin]: Create a new user in the database and LDAP - seed: Import default molecules and create default users - start-docker: Start docker containers @@ -20,28 +23,27 @@ set -o pipefail # FUNCTIONS # ----------------------------------------------------------------------------- fail() { - echo "Error. Exiting." - # stop_docker_services - echo "Exited because of an error." + colored_echo "Error. Exiting." "$RED" + stop_docker_services exit 1 } colored_echo() { - GREEN="\e[42m" - DEFAULT="\e[0m" - echo -e "${GREEN}[dev-env.sh] ${1}${DEFAULT}" + COLOR=${2:-$GREEN} + echo -e "${COLOR}[dev-env.sh] ${1}${DEFAULT}" } check_system_dependencies() { HELP_MESSAGE="Please refer to the developer documentation to find how to install the required dependencies: https://github.com/ValFraNath/apothiquiz/wiki/Developer-setup." - colored_echo "Checking system dependencies..." + echo -e -n "${GREEN}[dev-env.sh] Checking system dependencies...${DEFAULT}" DEPS=("docker") for DEP in "${DEPS[@]}"; do if ! command -v "$DEP" >/dev/null 2>&1; then - colored_echo "$DEP dependency is missing." - colored_echo "$HELP_MESSAGE" + echo + colored_echo "$DEP dependency is missing." "$RED" + colored_echo "$HELP_MESSAGE" "$RED" exit 1 fi done @@ -53,21 +55,19 @@ check_system_dependencies() { # fi if ! [ -f "dev.env" ]; then + echo colored_echo " Missing dev.env file, creating with default values from .env.example" colored_echo " Feel free to edit your local .env to match your dev environment" cp ".env.example" "dev.env" || fail fi - colored_echo " Pulling missing docker containers." - $DC pull || fail - - colored_echo "...OK!" + echo -e "${GREEN}OK!${DEFAULT}" } check_npm_dependencies() { colored_echo "Checking npm dependencies..." for DIR in "client" "server"; do - if ! [ -d "node_modules" ] || ! $DC exec --workdir "/app/$DIR" node npm list --all >/dev/null 2>&1; then + if ! [ -d "$DIR/node_modules" ] || ! $DC exec --workdir "/app/$DIR" node npm list --all >/dev/null 2>&1; then colored_echo " Installing npm dependencies in $DIR" $DC exec --workdir "/app/$DIR" node npm install || fail fi @@ -108,9 +108,10 @@ test_server() { sleep 2 done - $DC exec --workdir "/app/server" --env APOTHIQUIZ_DB_PORT=3307 node npm run test + $DC exec --workdir "/app/server" --env APOTHIQUIZ_DB_PORT=3307 --no-TTY node npm run test $DC stop mariadb-test $DC rm mariadb-test + echo } create_user() { @@ -150,7 +151,8 @@ create_user() { echo "INSERT IGNORE INTO \`user\` (\`us_login\`,\`us_admin\`) VALUES ('$USERID',$IS_ADMIN)" | $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb - colored_echo "User $USERID created successfully, the default password is '$PASSWORD'" +[[ "$IS_ADMIN" = "1" ]] && IS_ADMIN="Admin" || IS_ADMIN="User" + colored_echo "${IS_ADMIN} ${USERID} created successfully, the default password is '$PASSWORD'" } # ----------------------------------------------------------------------------- @@ -158,7 +160,7 @@ create_user() { # ----------------------------------------------------------------------------- if [ -z "$1" ]; then - colored_echo "$HELP" + echo -e "$HELP" exit 0 fi @@ -193,9 +195,10 @@ case "$1" in wait exit 0 ;; + "create-user") if [ -z "$2" ]; then - colored_echo "Il manque le nom d'utilisateur" + colored_echo "Username is missing" "$RED" exit 1 fi create_user "$2" "$3" "$4" @@ -237,7 +240,7 @@ case "$1" in ;; "help" | *) - echo "$HELP" + echo -e "$HELP" exit 0 ;; From 8d22a20e1562b2190f3b20f8ec034e4680dc3a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nathana=C3=ABl=20Houn?= Date: Fri, 24 Feb 2023 20:37:08 +0100 Subject: [PATCH 44/44] fix: seeded user shouldn't be admin --- dev-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-env.sh b/dev-env.sh index cda4ed54..17287e8f 100644 --- a/dev-env.sh +++ b/dev-env.sh @@ -212,7 +212,7 @@ case "$1" in $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb < ./server/test/required-data/config.sql || true $DC exec --no-TTY mariadb mariadb --user=root --password=root apothiquizDb < ./server/test/required-data/molecules.sql || true - create_user "user" "password" "1" + create_user "user" "password" create_user "admin" "password" "1" exit 0 ;;
Version : {process.env.REACT_APP_VERSION ?? "developement"}{process.env.REACT_APP_VERSION ?? "développement"}