From 215414fb87a851cfe505fea031e7fb1b679cea26 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 May 2024 13:47:54 +0200 Subject: [PATCH 01/41] ci: fix release tag ref --- .forgejo/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 4c334fb..731a1f8 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -65,7 +65,7 @@ jobs: run: | { echo 'CHANGELOG<> "$GITHUB_ENV" - name: 🎉 Publish release @@ -78,4 +78,4 @@ jobs: - name: 🚀 Deploy to server if: ${{ startsWith(github.ref, 'refs/tags/v') }} run: | - curl -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update + curl -s -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update From fb958c0c5592229037e50407af9f79d0894eb369 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 May 2024 14:05:39 +0200 Subject: [PATCH 02/41] fix: disable NPM update notifier --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 52715d0..6adb62d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,11 @@ COPY package.json pnpm-lock.yaml run/entrypoint.sh ./ COPY prisma ./prisma # Setup pnpm, install Prisma CLI (for generating client) and install dependencies -RUN corepack enable && pnpm i --prod && pnpm audit fix && npx prisma generate +RUN npm config set update-notifier false && \ + corepack enable && \ + pnpm i --prod && \ + pnpm audit fix && \ + npx prisma generate # copy built SvelteKit app to /app COPY build ./ From d7ecac657fde01bee34c919c900d2e69614ef69a Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 May 2024 14:08:56 +0200 Subject: [PATCH 03/41] chore(release): release v0.3.2 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f556d50..879e1cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. +## [v0.3.2](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.1..v0.3.2) - 2024-05-13 + +### 🐛 Bug Fixes + +- Disable NPM update notifier - ([fb958c0](https://code.thetadev.de/HSA/Visitenbuch/commit/fb958c0c5592229037e50407af9f79d0894eb369)) + + ## [v0.3.1](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.0..v0.3.1) - 2024-05-13 ### 🚀 Features diff --git a/package.json b/package.json index 1f69a82..89c0900 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visitenbuch", - "version": "0.3.1", + "version": "0.3.2", "private": true, "license": "AGPL-3.0", "scripts": { From 74742ae61be0933bbabdf76a6f426848551711f0 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 May 2024 14:18:21 +0200 Subject: [PATCH 04/41] ci: fix tag fetching --- .forgejo/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 731a1f8..4d771bd 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -45,6 +45,8 @@ jobs: steps: - name: 👁️ Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: 📦 pnpm install run: pnpm install @@ -65,7 +67,7 @@ jobs: run: | { echo 'CHANGELOG<> "$GITHUB_ENV" - name: 🎉 Publish release From 009729b877e4f050fa0d1159aaa86dd43d534621 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 13 May 2024 23:33:35 +0200 Subject: [PATCH 05/41] fix: update ESLint config and fix lints --- .dockerignore | 4 +++- .gitignore | 3 +++ eslint.config.js | 14 ++++++++---- package.json | 2 +- src/app.d.ts | 4 +++- src/hooks.client.ts | 2 +- src/hooks.server.ts | 4 ++-- src/lib/components/filter/Autocomplete.svelte | 9 ++++---- src/lib/components/filter/FilterBar.svelte | 8 +++---- src/lib/components/filter/FilterChip.svelte | 4 ++-- src/lib/components/filter/filters.ts | 2 +- src/lib/components/filter/types.ts | 4 +++- src/lib/components/table/SortHeader.svelte | 2 +- src/lib/components/ui/WeekSelector.svelte | 2 +- src/lib/server/auth.ts | 2 +- src/lib/server/query/util.ts | 5 +++-- src/lib/server/trpc/context.ts | 4 +--- src/lib/server/trpc/router.ts | 8 ------- src/lib/shared/util/date.ts | 2 +- src/lib/shared/util/util.ts | 4 ++-- src/routes/+layout.server.ts | 2 +- vite.config.js => vite.config.ts | 22 +++++++++++-------- 22 files changed, 61 insertions(+), 52 deletions(-) rename vite.config.js => vite.config.ts (79%) diff --git a/.dockerignore b/.dockerignore index 91f5648..62669bc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,8 @@ node_modules /package .env .env.* -!.env.example +.eslintcache vite.config.js.timestamp-* vite.config.ts.timestamp-* +vitest.config.*.js.timestamp-* +vitest.config.*.ts.timestamp-* diff --git a/.gitignore b/.gitignore index cdc9c6b..ffc5dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,8 @@ node_modules /.svelte-kit /package .env +.eslintcache vite.config.js.timestamp-* vite.config.ts.timestamp-* +vitest.config.*.js.timestamp-* +vitest.config.*.ts.timestamp-* diff --git a/eslint.config.js b/eslint.config.js index 9421a96..3d6696e 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -14,7 +14,7 @@ import ts from "typescript-eslint"; export default [ js.configs.recommended, - ...ts.configs.recommended, + ...ts.configs.recommendedTypeChecked, ...svelte.configs["flat/recommended"], // TS-Svelte { @@ -585,10 +585,16 @@ export default [ }, ], "@typescript-eslint/return-await": "error", - "@typescript-eslint/no-shadow": ["error", { allow: ["i", "j"] }], "no-shadow-restricted-names": "error", - "@typescript-eslint/no-loss-of-precision": "error", + "@typescript-eslint/promise-function-async": "error", + "@typescript-eslint/no-base-to-string": "off", + + // these clash with Svelte generics + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-member-access": "off", }, }, @@ -812,7 +818,7 @@ export default [ ".svelte-kit/", "*.config.cjs", "vite.config.js.timestamp-*", - "vite.config.ts.timestamp-*", + "vitest.config.*.timestamp-*", ".tmp/", ], }, diff --git a/package.json b/package.json index 89c0900..61fcd29 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test": "vitest --run && vitest --config vitest.config.integration.js --run", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "eslint . --max-warnings=0", + "lint": "eslint . --max-warnings=0 --cache", "format": "eslint . --fix", "test:unit": "vitest", "test:integration": "vitest --config vitest.config.integration.js", diff --git a/src/app.d.ts b/src/app.d.ts index 13a994c..b86d0aa 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -8,7 +8,9 @@ declare global { interface Locals { session: Session | null; } - // interface PageData {} + interface PageData { + session: Session | null; + } // interface Platform {} } diff --git a/src/hooks.client.ts b/src/hooks.client.ts index 4aac5a8..4cc17f9 100644 --- a/src/hooks.client.ts +++ b/src/hooks.client.ts @@ -3,7 +3,7 @@ import { TRPCClientError } from "@trpc/client"; const CHECK_CONNECTION = "Die Seite konnte nicht geladen werden, prüfen sie ihre Verbindung"; -export const handleError: HandleClientError = async ({ error, message, status }) => { +export const handleError: HandleClientError = ({ error, message, status }) => { // If there are client-side errors, SvelteKit always returns the nondescript // "Internal error" message. The most common errors should be mapped to a more // detailed description diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 9a0c57d..a7fddf5 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -33,5 +33,5 @@ export const handle = sequence( ); // Allow server application to exit -process.on("SIGINT", process.exit); // Ctrl+C -process.on("SIGTERM", process.exit); // docker stop +process.on("SIGINT", () => process.exit()); // Ctrl+C +process.on("SIGTERM", () => process.exit()); // docker stop diff --git a/src/lib/components/filter/Autocomplete.svelte b/src/lib/components/filter/Autocomplete.svelte index 9009450..f1a7885 100644 --- a/src/lib/components/filter/Autocomplete.svelte +++ b/src/lib/components/filter/Autocomplete.svelte @@ -1,8 +1,9 @@ -
- -
From b696ee88940f4d259b7f2287ab20b7236b08cf54 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 20 May 2024 15:11:32 +0200 Subject: [PATCH 38/41] chore(release): release v0.3.5 --- CHANGELOG.md | 22 ++++++++++++++++++++++ package.json | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50f81d..0540fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. +## [v0.3.5](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.4..v0.3.5) - 2024-05-20 + +### 🚀 Features + +- Focus filter bar when pressing F - ([ad796dc](https://code.thetadev.de/HSA/Visitenbuch/commit/ad796dcb578b79b566559d1c22c99f0231a03251)) +- Add optional Keycloak endpoint config - ([d746e47](https://code.thetadev.de/HSA/Visitenbuch/commit/d746e4787d70080bbc22b37263bbfa695c1a7d72)) + +### 🐛 Bug Fixes + +- Dont create entry executions if entry is only postponed - ([34e54fa](https://code.thetadev.de/HSA/Visitenbuch/commit/34e54fa4afdf17e7258cbc5ccac5a3d094ee161b)) +- HumanDate capitalization - ([f4f03ab](https://code.thetadev.de/HSA/Visitenbuch/commit/f4f03ab4914f850b15acf7bb39da34b1abb587a7)) +- Filterbar does not exclude present filters from URL, text filters dont confirm when defocused - ([9ed5f15](https://code.thetadev.de/HSA/Visitenbuch/commit/9ed5f15b9ef237cc400b069928baeb920b2d3681)) +- [**breaking**] Ensure category, room and station names are unique - ([98c62ac](https://code.thetadev.de/HSA/Visitenbuch/commit/98c62ac4603fa6d7c97e1a439f613379db7a2587)) +- Allow multiple date filters - ([2a4bda7](https://code.thetadev.de/HSA/Visitenbuch/commit/2a4bda70c6cfd85b4a32989a2e19ba718cc7717e)) +- Add dumb-init to docker image - ([47f0a08](https://code.thetadev.de/HSA/Visitenbuch/commit/47f0a08ea3dbd8b1721a11c52b36c42ad56e8e29)) +- Remove test route - ([03f6c58](https://code.thetadev.de/HSA/Visitenbuch/commit/03f6c5848201eff02999c6b9323ec1515d68fd5a)) + +### ⚙️ Miscellaneous Tasks + +- Remove unused zod-form-data dependency - ([882ae66](https://code.thetadev.de/HSA/Visitenbuch/commit/882ae66a6a137259388525df2c91b8e1ed924d86)) + + ## [v0.3.4](https://code.thetadev.de/HSA/Visitenbuch/compare/v0.3.3..v0.3.4) - 2024-05-16 ### 🚀 Features diff --git a/package.json b/package.json index 67220ca..1bde82a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "visitenbuch", - "version": "0.3.4", + "version": "0.3.5", "private": true, "license": "AGPL-3.0", "scripts": { From 8179c83383756006fb2cb4429ce1ddb6b61e5d94 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Mon, 20 May 2024 22:59:27 +0200 Subject: [PATCH 39/41] update README --- README.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f1a26e..5eec35a 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,24 @@ The project template was created using [`create-svelte`](https://github.com/svel Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: ```bash -npm run dev +pnpm run dev # or start the server and open the app in a new browser tab -npm run dev -- --open +pnpm run dev -- --open ``` -### Handle the prisma ORM +### Test environment + +The project depends on a PostgreSQL database and an OIDC authentication server. +You can setup both using the `run/db_up.sh` script. This creates a new testing environment using +docker-compose and fills the test database with mock data + +### Use the Pisma ORM + +If you apply changes to the database scheme, you have to create a new migration to apply these changes to +the database. ```bash -./run/db_up.sh # Start the docker container, create a new database and run migrations + insert test data npx prisma migrate dev --name my_migration --create-only # Create a new migration npx prisma migrate dev # Apply migrations to the database ``` @@ -28,13 +36,21 @@ npx prisma migrate dev # Apply migrations to the database To create a production version of your app: ```bash -npm run build +pnpm run build ``` You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +### Test + +```bash +pnpm test # Unit- und Integrationstests +pnpm test:e2e # End2End-Tests +``` + + ### Release To release a new version, tun the release script with the new version as a parameter @@ -42,3 +58,10 @@ To release a new version, tun the release script with the new version as a param ```bash ./release.sh 1.0.0 ``` + +### Building docker image + +```bash +pnpm run build +docker build -t thetadev256/visitenbuch . +``` From 297f5cfa925925956b7951ef3afeff7058971f30 Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Tue, 21 May 2024 03:58:13 +0200 Subject: [PATCH 40/41] update README --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5eec35a..cc42fac 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ for the university hospital in Augsburg ## Development -The project template was created using [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +The project template was created using +[`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +Once you've created a project and installed dependencies with `npm install` (or +`pnpm install` or `yarn`), start a development server: ```bash pnpm run dev @@ -17,14 +19,17 @@ pnpm run dev -- --open ### Test environment -The project depends on a PostgreSQL database and an OIDC authentication server. -You can setup both using the `run/db_up.sh` script. This creates a new testing environment using -docker-compose and fills the test database with mock data +Copy the `.env.example` file to `.env` to get access to the required configuration +variables. + +The project depends on a PostgreSQL database and an OIDC authentication server. You can +setup both using the `run/db_up.sh` script. This creates a new testing environment using +docker-compose and fills the test database with mock data. ### Use the Pisma ORM -If you apply changes to the database scheme, you have to create a new migration to apply these changes to -the database. +If you apply changes to the database scheme, you have to create a new migration to apply +these changes to the database. ```bash npx prisma migrate dev --name my_migration --create-only # Create a new migration @@ -41,7 +46,8 @@ pnpm run build You can preview the production build with `npm run preview`. -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +> To deploy your app, you may need to install an +> [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. ### Test @@ -50,7 +56,6 @@ pnpm test # Unit- und Integrationstests pnpm test:e2e # End2End-Tests ``` - ### Release To release a new version, tun the release script with the new version as a parameter From 4cbf1ca7c3d4e5a604095ef3a8913ec54f32e4ea Mon Sep 17 00:00:00 2001 From: ThetaDev Date: Fri, 24 May 2024 17:49:06 +0200 Subject: [PATCH 41/41] ci: set fetch-depth to 0 --- .forgejo/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index d2ea852..c286741 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -68,7 +68,7 @@ jobs: - name: 👁️ Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 1 # important to fetch tag logs + fetch-depth: 0 # important to fetch tag logs - name: 📦 pnpm install run: pnpm install