From afcc84ea215a0b5d2a9de633d59be34f0b5ddd4e Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sat, 8 Feb 2025 18:15:44 +0100 Subject: [PATCH 1/7] refactor: Moving server to its own directory --- .env.example => server/.env.example | 0 {@types => server/@types}/node/environment.d.ts | 0 README.md => server/README.md | 0 docker-compose.yml => server/docker-compose.yml | 0 eslint.config.js => server/eslint.config.js | 0 {migrations => server/migrations}/001.do.users.sql | 0 .../migrations}/001.undo.users.sql | 0 {migrations => server/migrations}/002.do.tasks.sql | 0 .../migrations}/002.undo.tasks.sql | 0 .../migrations}/003.do.user_tasks.sql | 0 .../migrations}/003.undo.user_tasks.sql | 0 {migrations => server/migrations}/004.do.roles.sql | 0 .../migrations}/004.undo.roles.sql | 0 .../migrations}/005.do.user_roles.sql | 0 .../migrations}/005.undo.user_roles.sql | 0 package.json => server/package.json | 0 {scripts => server/scripts}/create-database.ts | 0 {scripts => server/scripts}/drop-database.ts | 0 {scripts => server/scripts}/migrate.ts | 0 {scripts => server/scripts}/seed-database.ts | 0 {src => server/src}/app.ts | 0 {src => server/src}/plugins/README.md | 0 {src => server/src}/plugins/custom/authorization.ts | 0 {src => server/src}/plugins/custom/scrypt.ts | 0 {src => server/src}/plugins/external/cors.ts | 0 {src => server/src}/plugins/external/env.ts | 0 {src => server/src}/plugins/external/helmet.ts | 0 {src => server/src}/plugins/external/knex.ts | 0 {src => server/src}/plugins/external/multipart.ts | 0 {src => server/src}/plugins/external/rate-limit.ts | 0 {src => server/src}/plugins/external/sensible.ts | 0 {src => server/src}/plugins/external/session.ts | 0 {src => server/src}/plugins/external/static.ts | 0 {src => server/src}/plugins/external/swagger.ts | 0 .../src}/plugins/external/under-pressure.ts | 0 {src => server/src}/routes/README.md | 0 {src => server/src}/routes/api/auth/index.ts | 0 {src => server/src}/routes/api/autohooks.ts | 0 {src => server/src}/routes/api/index.ts | 0 {src => server/src}/routes/api/tasks/index.ts | 0 {src => server/src}/routes/api/users/index.ts | 0 {src => server/src}/routes/home.ts | 0 {src => server/src}/schemas/auth.ts | 0 {src => server/src}/schemas/common.ts | 0 {src => server/src}/schemas/tasks.ts | 0 {src => server/src}/schemas/users.ts | 0 {src => server/src}/server.ts | 0 {test => server/test}/app/cors.test.ts | 0 {test => server/test}/app/error-handler.test.ts | 0 {test => server/test}/app/not-found-handler.test.ts | 0 {test => server/test}/app/rate-limit.test.ts | 0 {test => server/test}/helper.ts | 0 {test => server/test}/plugins/scrypt.test.ts | 0 {test => server/test}/routes/api/api.test.ts | 0 {test => server/test}/routes/api/auth/auth.test.ts | 0 .../test}/routes/api/tasks/fixtures/one_line.csv | 0 .../test}/routes/api/tasks/fixtures/short-logo.png | Bin .../test}/routes/api/tasks/tasks.test.ts | 0 .../test}/routes/api/users/users.test.ts | 0 {test => server/test}/routes/home.test.ts | 0 {test => server/test}/tsconfig.json | 0 tsconfig.json => server/tsconfig.json | 0 62 files changed, 0 insertions(+), 0 deletions(-) rename .env.example => server/.env.example (100%) rename {@types => server/@types}/node/environment.d.ts (100%) rename README.md => server/README.md (100%) rename docker-compose.yml => server/docker-compose.yml (100%) rename eslint.config.js => server/eslint.config.js (100%) rename {migrations => server/migrations}/001.do.users.sql (100%) rename {migrations => server/migrations}/001.undo.users.sql (100%) rename {migrations => server/migrations}/002.do.tasks.sql (100%) rename {migrations => server/migrations}/002.undo.tasks.sql (100%) rename {migrations => server/migrations}/003.do.user_tasks.sql (100%) rename {migrations => server/migrations}/003.undo.user_tasks.sql (100%) rename {migrations => server/migrations}/004.do.roles.sql (100%) rename {migrations => server/migrations}/004.undo.roles.sql (100%) rename {migrations => server/migrations}/005.do.user_roles.sql (100%) rename {migrations => server/migrations}/005.undo.user_roles.sql (100%) rename package.json => server/package.json (100%) rename {scripts => server/scripts}/create-database.ts (100%) rename {scripts => server/scripts}/drop-database.ts (100%) rename {scripts => server/scripts}/migrate.ts (100%) rename {scripts => server/scripts}/seed-database.ts (100%) rename {src => server/src}/app.ts (100%) rename {src => server/src}/plugins/README.md (100%) rename {src => server/src}/plugins/custom/authorization.ts (100%) rename {src => server/src}/plugins/custom/scrypt.ts (100%) rename {src => server/src}/plugins/external/cors.ts (100%) rename {src => server/src}/plugins/external/env.ts (100%) rename {src => server/src}/plugins/external/helmet.ts (100%) rename {src => server/src}/plugins/external/knex.ts (100%) rename {src => server/src}/plugins/external/multipart.ts (100%) rename {src => server/src}/plugins/external/rate-limit.ts (100%) rename {src => server/src}/plugins/external/sensible.ts (100%) rename {src => server/src}/plugins/external/session.ts (100%) rename {src => server/src}/plugins/external/static.ts (100%) rename {src => server/src}/plugins/external/swagger.ts (100%) rename {src => server/src}/plugins/external/under-pressure.ts (100%) rename {src => server/src}/routes/README.md (100%) rename {src => server/src}/routes/api/auth/index.ts (100%) rename {src => server/src}/routes/api/autohooks.ts (100%) rename {src => server/src}/routes/api/index.ts (100%) rename {src => server/src}/routes/api/tasks/index.ts (100%) rename {src => server/src}/routes/api/users/index.ts (100%) rename {src => server/src}/routes/home.ts (100%) rename {src => server/src}/schemas/auth.ts (100%) rename {src => server/src}/schemas/common.ts (100%) rename {src => server/src}/schemas/tasks.ts (100%) rename {src => server/src}/schemas/users.ts (100%) rename {src => server/src}/server.ts (100%) rename {test => server/test}/app/cors.test.ts (100%) rename {test => server/test}/app/error-handler.test.ts (100%) rename {test => server/test}/app/not-found-handler.test.ts (100%) rename {test => server/test}/app/rate-limit.test.ts (100%) rename {test => server/test}/helper.ts (100%) rename {test => server/test}/plugins/scrypt.test.ts (100%) rename {test => server/test}/routes/api/api.test.ts (100%) rename {test => server/test}/routes/api/auth/auth.test.ts (100%) rename {test => server/test}/routes/api/tasks/fixtures/one_line.csv (100%) rename {test => server/test}/routes/api/tasks/fixtures/short-logo.png (100%) rename {test => server/test}/routes/api/tasks/tasks.test.ts (100%) rename {test => server/test}/routes/api/users/users.test.ts (100%) rename {test => server/test}/routes/home.test.ts (100%) rename {test => server/test}/tsconfig.json (100%) rename tsconfig.json => server/tsconfig.json (100%) diff --git a/.env.example b/server/.env.example similarity index 100% rename from .env.example rename to server/.env.example diff --git a/@types/node/environment.d.ts b/server/@types/node/environment.d.ts similarity index 100% rename from @types/node/environment.d.ts rename to server/@types/node/environment.d.ts diff --git a/README.md b/server/README.md similarity index 100% rename from README.md rename to server/README.md diff --git a/docker-compose.yml b/server/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to server/docker-compose.yml diff --git a/eslint.config.js b/server/eslint.config.js similarity index 100% rename from eslint.config.js rename to server/eslint.config.js diff --git a/migrations/001.do.users.sql b/server/migrations/001.do.users.sql similarity index 100% rename from migrations/001.do.users.sql rename to server/migrations/001.do.users.sql diff --git a/migrations/001.undo.users.sql b/server/migrations/001.undo.users.sql similarity index 100% rename from migrations/001.undo.users.sql rename to server/migrations/001.undo.users.sql diff --git a/migrations/002.do.tasks.sql b/server/migrations/002.do.tasks.sql similarity index 100% rename from migrations/002.do.tasks.sql rename to server/migrations/002.do.tasks.sql diff --git a/migrations/002.undo.tasks.sql b/server/migrations/002.undo.tasks.sql similarity index 100% rename from migrations/002.undo.tasks.sql rename to server/migrations/002.undo.tasks.sql diff --git a/migrations/003.do.user_tasks.sql b/server/migrations/003.do.user_tasks.sql similarity index 100% rename from migrations/003.do.user_tasks.sql rename to server/migrations/003.do.user_tasks.sql diff --git a/migrations/003.undo.user_tasks.sql b/server/migrations/003.undo.user_tasks.sql similarity index 100% rename from migrations/003.undo.user_tasks.sql rename to server/migrations/003.undo.user_tasks.sql diff --git a/migrations/004.do.roles.sql b/server/migrations/004.do.roles.sql similarity index 100% rename from migrations/004.do.roles.sql rename to server/migrations/004.do.roles.sql diff --git a/migrations/004.undo.roles.sql b/server/migrations/004.undo.roles.sql similarity index 100% rename from migrations/004.undo.roles.sql rename to server/migrations/004.undo.roles.sql diff --git a/migrations/005.do.user_roles.sql b/server/migrations/005.do.user_roles.sql similarity index 100% rename from migrations/005.do.user_roles.sql rename to server/migrations/005.do.user_roles.sql diff --git a/migrations/005.undo.user_roles.sql b/server/migrations/005.undo.user_roles.sql similarity index 100% rename from migrations/005.undo.user_roles.sql rename to server/migrations/005.undo.user_roles.sql diff --git a/package.json b/server/package.json similarity index 100% rename from package.json rename to server/package.json diff --git a/scripts/create-database.ts b/server/scripts/create-database.ts similarity index 100% rename from scripts/create-database.ts rename to server/scripts/create-database.ts diff --git a/scripts/drop-database.ts b/server/scripts/drop-database.ts similarity index 100% rename from scripts/drop-database.ts rename to server/scripts/drop-database.ts diff --git a/scripts/migrate.ts b/server/scripts/migrate.ts similarity index 100% rename from scripts/migrate.ts rename to server/scripts/migrate.ts diff --git a/scripts/seed-database.ts b/server/scripts/seed-database.ts similarity index 100% rename from scripts/seed-database.ts rename to server/scripts/seed-database.ts diff --git a/src/app.ts b/server/src/app.ts similarity index 100% rename from src/app.ts rename to server/src/app.ts diff --git a/src/plugins/README.md b/server/src/plugins/README.md similarity index 100% rename from src/plugins/README.md rename to server/src/plugins/README.md diff --git a/src/plugins/custom/authorization.ts b/server/src/plugins/custom/authorization.ts similarity index 100% rename from src/plugins/custom/authorization.ts rename to server/src/plugins/custom/authorization.ts diff --git a/src/plugins/custom/scrypt.ts b/server/src/plugins/custom/scrypt.ts similarity index 100% rename from src/plugins/custom/scrypt.ts rename to server/src/plugins/custom/scrypt.ts diff --git a/src/plugins/external/cors.ts b/server/src/plugins/external/cors.ts similarity index 100% rename from src/plugins/external/cors.ts rename to server/src/plugins/external/cors.ts diff --git a/src/plugins/external/env.ts b/server/src/plugins/external/env.ts similarity index 100% rename from src/plugins/external/env.ts rename to server/src/plugins/external/env.ts diff --git a/src/plugins/external/helmet.ts b/server/src/plugins/external/helmet.ts similarity index 100% rename from src/plugins/external/helmet.ts rename to server/src/plugins/external/helmet.ts diff --git a/src/plugins/external/knex.ts b/server/src/plugins/external/knex.ts similarity index 100% rename from src/plugins/external/knex.ts rename to server/src/plugins/external/knex.ts diff --git a/src/plugins/external/multipart.ts b/server/src/plugins/external/multipart.ts similarity index 100% rename from src/plugins/external/multipart.ts rename to server/src/plugins/external/multipart.ts diff --git a/src/plugins/external/rate-limit.ts b/server/src/plugins/external/rate-limit.ts similarity index 100% rename from src/plugins/external/rate-limit.ts rename to server/src/plugins/external/rate-limit.ts diff --git a/src/plugins/external/sensible.ts b/server/src/plugins/external/sensible.ts similarity index 100% rename from src/plugins/external/sensible.ts rename to server/src/plugins/external/sensible.ts diff --git a/src/plugins/external/session.ts b/server/src/plugins/external/session.ts similarity index 100% rename from src/plugins/external/session.ts rename to server/src/plugins/external/session.ts diff --git a/src/plugins/external/static.ts b/server/src/plugins/external/static.ts similarity index 100% rename from src/plugins/external/static.ts rename to server/src/plugins/external/static.ts diff --git a/src/plugins/external/swagger.ts b/server/src/plugins/external/swagger.ts similarity index 100% rename from src/plugins/external/swagger.ts rename to server/src/plugins/external/swagger.ts diff --git a/src/plugins/external/under-pressure.ts b/server/src/plugins/external/under-pressure.ts similarity index 100% rename from src/plugins/external/under-pressure.ts rename to server/src/plugins/external/under-pressure.ts diff --git a/src/routes/README.md b/server/src/routes/README.md similarity index 100% rename from src/routes/README.md rename to server/src/routes/README.md diff --git a/src/routes/api/auth/index.ts b/server/src/routes/api/auth/index.ts similarity index 100% rename from src/routes/api/auth/index.ts rename to server/src/routes/api/auth/index.ts diff --git a/src/routes/api/autohooks.ts b/server/src/routes/api/autohooks.ts similarity index 100% rename from src/routes/api/autohooks.ts rename to server/src/routes/api/autohooks.ts diff --git a/src/routes/api/index.ts b/server/src/routes/api/index.ts similarity index 100% rename from src/routes/api/index.ts rename to server/src/routes/api/index.ts diff --git a/src/routes/api/tasks/index.ts b/server/src/routes/api/tasks/index.ts similarity index 100% rename from src/routes/api/tasks/index.ts rename to server/src/routes/api/tasks/index.ts diff --git a/src/routes/api/users/index.ts b/server/src/routes/api/users/index.ts similarity index 100% rename from src/routes/api/users/index.ts rename to server/src/routes/api/users/index.ts diff --git a/src/routes/home.ts b/server/src/routes/home.ts similarity index 100% rename from src/routes/home.ts rename to server/src/routes/home.ts diff --git a/src/schemas/auth.ts b/server/src/schemas/auth.ts similarity index 100% rename from src/schemas/auth.ts rename to server/src/schemas/auth.ts diff --git a/src/schemas/common.ts b/server/src/schemas/common.ts similarity index 100% rename from src/schemas/common.ts rename to server/src/schemas/common.ts diff --git a/src/schemas/tasks.ts b/server/src/schemas/tasks.ts similarity index 100% rename from src/schemas/tasks.ts rename to server/src/schemas/tasks.ts diff --git a/src/schemas/users.ts b/server/src/schemas/users.ts similarity index 100% rename from src/schemas/users.ts rename to server/src/schemas/users.ts diff --git a/src/server.ts b/server/src/server.ts similarity index 100% rename from src/server.ts rename to server/src/server.ts diff --git a/test/app/cors.test.ts b/server/test/app/cors.test.ts similarity index 100% rename from test/app/cors.test.ts rename to server/test/app/cors.test.ts diff --git a/test/app/error-handler.test.ts b/server/test/app/error-handler.test.ts similarity index 100% rename from test/app/error-handler.test.ts rename to server/test/app/error-handler.test.ts diff --git a/test/app/not-found-handler.test.ts b/server/test/app/not-found-handler.test.ts similarity index 100% rename from test/app/not-found-handler.test.ts rename to server/test/app/not-found-handler.test.ts diff --git a/test/app/rate-limit.test.ts b/server/test/app/rate-limit.test.ts similarity index 100% rename from test/app/rate-limit.test.ts rename to server/test/app/rate-limit.test.ts diff --git a/test/helper.ts b/server/test/helper.ts similarity index 100% rename from test/helper.ts rename to server/test/helper.ts diff --git a/test/plugins/scrypt.test.ts b/server/test/plugins/scrypt.test.ts similarity index 100% rename from test/plugins/scrypt.test.ts rename to server/test/plugins/scrypt.test.ts diff --git a/test/routes/api/api.test.ts b/server/test/routes/api/api.test.ts similarity index 100% rename from test/routes/api/api.test.ts rename to server/test/routes/api/api.test.ts diff --git a/test/routes/api/auth/auth.test.ts b/server/test/routes/api/auth/auth.test.ts similarity index 100% rename from test/routes/api/auth/auth.test.ts rename to server/test/routes/api/auth/auth.test.ts diff --git a/test/routes/api/tasks/fixtures/one_line.csv b/server/test/routes/api/tasks/fixtures/one_line.csv similarity index 100% rename from test/routes/api/tasks/fixtures/one_line.csv rename to server/test/routes/api/tasks/fixtures/one_line.csv diff --git a/test/routes/api/tasks/fixtures/short-logo.png b/server/test/routes/api/tasks/fixtures/short-logo.png similarity index 100% rename from test/routes/api/tasks/fixtures/short-logo.png rename to server/test/routes/api/tasks/fixtures/short-logo.png diff --git a/test/routes/api/tasks/tasks.test.ts b/server/test/routes/api/tasks/tasks.test.ts similarity index 100% rename from test/routes/api/tasks/tasks.test.ts rename to server/test/routes/api/tasks/tasks.test.ts diff --git a/test/routes/api/users/users.test.ts b/server/test/routes/api/users/users.test.ts similarity index 100% rename from test/routes/api/users/users.test.ts rename to server/test/routes/api/users/users.test.ts diff --git a/test/routes/home.test.ts b/server/test/routes/home.test.ts similarity index 100% rename from test/routes/home.test.ts rename to server/test/routes/home.test.ts diff --git a/test/tsconfig.json b/server/test/tsconfig.json similarity index 100% rename from test/tsconfig.json rename to server/test/tsconfig.json diff --git a/tsconfig.json b/server/tsconfig.json similarity index 100% rename from tsconfig.json rename to server/tsconfig.json From 72245c36077504a9d572abce69367827959ab3a5 Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sat, 8 Feb 2025 18:43:41 +0100 Subject: [PATCH 2/7] feat: create cra with vite --- client/.gitignore | 24 +++++++++++++ client/eslint.config.js | 28 +++++++++++++++ client/index.html | 13 +++++++ client/package.json | 29 ++++++++++++++++ client/public/vite.svg | 1 + client/src/App.css | 42 +++++++++++++++++++++++ client/src/App.tsx | 35 +++++++++++++++++++ client/src/assets/react.svg | 1 + client/src/index.css | 68 +++++++++++++++++++++++++++++++++++++ client/src/main.tsx | 10 ++++++ client/src/vite-env.d.ts | 1 + client/tsconfig.app.json | 26 ++++++++++++++ client/tsconfig.json | 7 ++++ client/tsconfig.node.json | 24 +++++++++++++ client/vite.config.ts | 7 ++++ 15 files changed, 316 insertions(+) create mode 100644 client/.gitignore create mode 100644 client/eslint.config.js create mode 100644 client/index.html create mode 100644 client/package.json create mode 100644 client/public/vite.svg create mode 100644 client/src/App.css create mode 100644 client/src/App.tsx create mode 100644 client/src/assets/react.svg create mode 100644 client/src/index.css create mode 100644 client/src/main.tsx create mode 100644 client/src/vite-env.d.ts create mode 100644 client/tsconfig.app.json create mode 100644 client/tsconfig.json create mode 100644 client/tsconfig.node.json create mode 100644 client/vite.config.ts diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 00000000..a547bf36 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/client/eslint.config.js b/client/eslint.config.js new file mode 100644 index 00000000..092408a9 --- /dev/null +++ b/client/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/client/index.html b/client/index.html new file mode 100644 index 00000000..e4b78eae --- /dev/null +++ b/client/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/client/package.json b/client/package.json new file mode 100644 index 00000000..f2057ce2 --- /dev/null +++ b/client/package.json @@ -0,0 +1,29 @@ +{ + "name": "client", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.0.0", + "react-dom": "^19.0.0" + }, + "devDependencies": { + "@eslint/js": "^9.19.0", + "@types/react": "^19.0.8", + "@types/react-dom": "^19.0.3", + "@vitejs/plugin-react": "^4.3.4", + "eslint": "^9.19.0", + "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react-refresh": "^0.4.18", + "globals": "^15.14.0", + "typescript": "~5.7.2", + "typescript-eslint": "^8.22.0", + "vite": "^6.1.0" + } +} diff --git a/client/public/vite.svg b/client/public/vite.svg new file mode 100644 index 00000000..e7b8dfb1 --- /dev/null +++ b/client/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/App.css b/client/src/App.css new file mode 100644 index 00000000..b9d355df --- /dev/null +++ b/client/src/App.css @@ -0,0 +1,42 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/client/src/App.tsx b/client/src/App.tsx new file mode 100644 index 00000000..3d7ded3f --- /dev/null +++ b/client/src/App.tsx @@ -0,0 +1,35 @@ +import { useState } from 'react' +import reactLogo from './assets/react.svg' +import viteLogo from '/vite.svg' +import './App.css' + +function App() { + const [count, setCount] = useState(0) + + return ( + <> +
+ + Vite logo + + + React logo + +
+

Vite + React

+
+ +

+ Edit src/App.tsx and save to test HMR +

+
+

+ Click on the Vite and React logos to learn more +

+ + ) +} + +export default App diff --git a/client/src/assets/react.svg b/client/src/assets/react.svg new file mode 100644 index 00000000..6c87de9b --- /dev/null +++ b/client/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/index.css b/client/src/index.css new file mode 100644 index 00000000..6119ad9a --- /dev/null +++ b/client/src/index.css @@ -0,0 +1,68 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/client/src/main.tsx b/client/src/main.tsx new file mode 100644 index 00000000..bef5202a --- /dev/null +++ b/client/src/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import './index.css' +import App from './App.tsx' + +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/client/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json new file mode 100644 index 00000000..358ca9ba --- /dev/null +++ b/client/tsconfig.app.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/client/tsconfig.json b/client/tsconfig.json new file mode 100644 index 00000000..1ffef600 --- /dev/null +++ b/client/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/client/tsconfig.node.json b/client/tsconfig.node.json new file mode 100644 index 00000000..db0becc8 --- /dev/null +++ b/client/tsconfig.node.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/client/vite.config.ts b/client/vite.config.ts new file mode 100644 index 00000000..8b0f57b9 --- /dev/null +++ b/client/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [react()], +}) From c7723c8c60cd5052a8285cdf4503adaa5a8f641d Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sat, 8 Feb 2025 18:44:06 +0100 Subject: [PATCH 3/7] doc: Add Readme --- client/README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 client/README.md diff --git a/client/README.md b/client/README.md new file mode 100644 index 00000000..979049c4 --- /dev/null +++ b/client/README.md @@ -0,0 +1,68 @@ +# React + TypeScript + Vite + +This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. + +## Getting started +Install the dependencies: +```bash +npm install +``` + +### Start the server +In dev mode: +```bash +npm run dev +``` + +### Build +To build the project: +```bash +npm run build +``` + +### Locally preview the production build +```bash +npm run preview +``` + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default tseslint.config({ + languageOptions: { + // other options... + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, +}) +``` + +- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` +- Optionally add `...tseslint.configs.stylisticTypeChecked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: + +```js +// eslint.config.js +import react from 'eslint-plugin-react' + +export default tseslint.config({ + // Set the react version + settings: { react: { version: '18.3' } }, + plugins: { + // Add the react plugin + react, + }, + rules: { + // other rules... + // Enable its recommended rules + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + }, +}) +``` From d535e739db4b7bfdd176d15cfaf24e42bfc06809 Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sun, 9 Feb 2025 01:28:53 +0100 Subject: [PATCH 4/7] chore(ci): Change directory to server before running server workflow --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af38703b..85726ecd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,7 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: @@ -47,12 +48,15 @@ jobs: - name: Install dependencies run: npm i + working-directory: ./server - name: Build run: npm run build -- --noEmit + working-directory: ./server - name: Lint Code run: npm run lint + working-directory: ./server - name: Generate COOKIE Secret run: | @@ -61,6 +65,7 @@ jobs: - name: Generate dummy .env for scripts using -env-file=.env flag run: touch .env + working-directory: ./server - name: Test env: @@ -74,3 +79,4 @@ jobs: RATE_LIMIT_MAX: 4 CAN_SEED_DATABASE: 1 run: npm run db:migrate && npm run test + working-directory: ./server From 601359dfa3e795a8a2202a8db04c15160f02084f Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sun, 9 Feb 2025 11:39:03 +0100 Subject: [PATCH 5/7] chore(docs): update SonarCloud exclusion rules - Update SonarCloud exclusion rules to exclude `server/test/**/*` instead of `test/**/*` --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 35835fb2..c86b87ed 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1 +1 @@ -sonar.exclusions=test/**/*,scripts/seed-database.ts +sonar.exclusions=server/test/**/*,scripts/seed-database.ts From c785da8123f0f4878e5e6037546748759c62cf3e Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sun, 9 Feb 2025 12:12:40 +0100 Subject: [PATCH 6/7] chore(client): Install Prettier - Add `.prettierrc` file with single quote and JSX single quote setting --- client/.prettierignore | 3 +++ client/.prettierrc | 4 ++++ client/package.json | 1 + client/src/App.tsx | 26 +++++++++++++------------- 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 client/.prettierignore create mode 100644 client/.prettierrc diff --git a/client/.prettierignore b/client/.prettierignore new file mode 100644 index 00000000..1b8ac889 --- /dev/null +++ b/client/.prettierignore @@ -0,0 +1,3 @@ +# Ignore artifacts: +build +coverage diff --git a/client/.prettierrc b/client/.prettierrc new file mode 100644 index 00000000..e29d5016 --- /dev/null +++ b/client/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "jsxSingleQuote": true +} diff --git a/client/package.json b/client/package.json index f2057ce2..882a24e1 100644 --- a/client/package.json +++ b/client/package.json @@ -22,6 +22,7 @@ "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.18", "globals": "^15.14.0", + "prettier": "3.4.2", "typescript": "~5.7.2", "typescript-eslint": "^8.22.0", "vite": "^6.1.0" diff --git a/client/src/App.tsx b/client/src/App.tsx index 3d7ded3f..310a7591 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,23 +1,23 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import { useState } from 'react'; +import reactLogo from './assets/react.svg'; +import viteLogo from '/vite.svg'; +import './App.css'; function App() { - const [count, setCount] = useState(0) + const [count, setCount] = useState(0); return ( <>

Vite + React

-
+
@@ -25,11 +25,11 @@ function App() { Edit src/App.tsx and save to test HMR

-

+

Click on the Vite and React logos to learn more

- ) + ); } -export default App +export default App; From 4bec8c8a68d06900f01cbdada48545fd3ec2151a Mon Sep 17 00:00:00 2001 From: Mathieuka Date: Sun, 9 Feb 2025 14:34:39 +0100 Subject: [PATCH 7/7] style(client): introduce css module --- client/src/{App.css => App.module.css} | 0 client/src/App.tsx | 10 +++++----- client/src/index.css | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) rename client/src/{App.css => App.module.css} (100%) diff --git a/client/src/App.css b/client/src/App.module.css similarity index 100% rename from client/src/App.css rename to client/src/App.module.css diff --git a/client/src/App.tsx b/client/src/App.tsx index 310a7591..174fe531 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import reactLogo from './assets/react.svg'; import viteLogo from '/vite.svg'; -import './App.css'; +import styles from './App.module.css'; function App() { const [count, setCount] = useState(0); @@ -10,14 +10,14 @@ function App() { <>

Vite + React

-
+
@@ -25,7 +25,7 @@ function App() { Edit src/App.tsx and save to test HMR

-

+

Click on the Vite and React logos to learn more

diff --git a/client/src/index.css b/client/src/index.css index 6119ad9a..1dd69192 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -1,3 +1,10 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + :root { font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; @@ -18,6 +25,7 @@ a { color: #646cff; text-decoration: inherit; } + a:hover { color: #535bf2; }