From c6d973e1261d5fb46dd786493bec34afcee761a1 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:34:22 +0200 Subject: [PATCH 01/13] CI : create specific build for preprod --- .gitlab-ci.yml | 28 ++++++++++++++++- package.json | 1 + public/site/config/config.php | 2 +- vite.config.js | 58 +++++++++++++++++++---------------- 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8617d19..2108350 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ build: script: - apk add --no-cache nodejs npm - npm install - - npm run build + - if [ "$CI_COMMIT_REF_NAME" = "dev" ]; then npm run build:preprod; else npm run build; fi - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -48,3 +48,29 @@ deploy: rsync_deploy vendor/ "$PROD_PATH/vendor/" rsync_deploy kirby/ "$PROD_PATH/kirby/" rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" + +deploy_dev: + stage: deploy + image: node:latest + only: + - dev + before_script: + - apt-get update -qq && apt-get install -y rsync sshpass + script: + - cd dist + - | + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$PREPROD_PATH/vendor/" + rsync_deploy kirby/ "$PREPROD_PATH/kirby/" + rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" diff --git a/package.json b/package.json index adb73d0..db18c29 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "build:preprod": "vite build --mode=staging", "preview": "vite preview" }, "dependencies": { diff --git a/public/site/config/config.php b/public/site/config/config.php index d4505ea..72ea0da 100644 --- a/public/site/config/config.php +++ b/public/site/config/config.php @@ -3,7 +3,7 @@ $regenerateSteps = require_once(__DIR__ . '/hooks/page-update--regenerate-project-steps-cache.php'); return [ - 'debug' => Dir::exists('assets/dist') ? false: true, + 'debug' => $_SERVER['HTTP_HOST'] !== 'designtopack.groupe-pochet.fr', 'cache' => [ 'pages' => [ 'active' => true diff --git a/vite.config.js b/vite.config.js index 53268a1..c235442 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,33 +1,37 @@ import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; -export default defineConfig({ - plugins: [vue()], - base: '/', - build: { - outDir: 'dist', - rollupOptions: { - output: { - entryFileNames: 'assets/dist/[name].js', - assetFileNames: 'assets/dist/[name].[ext]', +export default defineConfig(({ mode }) => { + return { + plugins: [vue()], + base: '/', + build: { + outDir: 'dist', + rollupOptions: { + output: { + entryFileNames: 'assets/dist/[name].js', + assetFileNames: 'assets/dist/[name].[ext]', + }, + }, + sourcemap: mode === 'staging', + minify: mode === 'production' ? 'esbuild' : false, + }, + server: { + watch: { + ignored: [ + '**/node_modules/**', + '**/.git/**', + '**/.cache/**', + '**/.vite/**', + '**/dist/**', + '**/*.log', + '**/.idea/**', + '**/.vscode/**', + '**/public/assets/**', + '**/local/**', + '/public/**', + ], }, }, - }, - server: { - watch: { - ignored: [ - '**/node_modules/**', - '**/.git/**', - '**/.cache/**', - '**/.vite/**', - '**/dist/**', - '**/*.log', - '**/.idea/**', - '**/.vscode/**', - '**/public/assets/**', - '**/local/**', - '/public/**', - ], - }, - }, + }; }); From dca0f18cbb20de2122f5f5f3a21745526370c567 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:38:42 +0200 Subject: [PATCH 02/13] improve CI --- .gitlab-ci.yml | 74 ++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2108350..50ba152 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ stages: variables: COMPOSER_ALLOW_SUPERUSER: '1' + SSH_PORT: '2244' build: stage: build @@ -11,7 +12,7 @@ build: script: - apk add --no-cache nodejs npm - npm install - - if [ "$CI_COMMIT_REF_NAME" = "dev" ]; then npm run build:preprod; else npm run build; fi + - if [ "$CI_COMMIT_REF_NAME" = "preprod" ]; then npm run build:preprod; else npm run build; fi - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -23,54 +24,51 @@ build: paths: - node_modules/ -deploy: +.deploy_script: &deploy_script | + cd dist + if [ ! -d "vendor" ]; then + echo "Error: vendor/ not found in dist (composer install may have failed)" + exit 1 + fi + + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p $SSH_PORT -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$TARGET_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$TARGET_PATH/vendor/" + rsync_deploy kirby/ "$TARGET_PATH/kirby/" + rsync_deploy assets/ "$TARGET_PATH/assets/" "--exclude 'tiles/'" + +deploy_prod: stage: deploy image: node:latest + needs: ['build'] only: - main before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - - cd dist - - | - rsync_deploy() { - local src=$1 - local dst=$2 - local exclude=$3 - cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" - [[ -n $exclude ]] && cmd="$cmd $exclude" - cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" - echo "$cmd" - eval $cmd - } + - TARGET_PATH=$PROD_PATH bash -c "$DEPLOY_SCRIPT" + variables: + DEPLOY_SCRIPT: *deploy_script - rsync_deploy site/ "$PROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" - rsync_deploy vendor/ "$PROD_PATH/vendor/" - rsync_deploy kirby/ "$PROD_PATH/kirby/" - rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" - -deploy_dev: +deploy_preprod: stage: deploy image: node:latest + needs: ['build'] only: - - dev + - preprod before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - - cd dist - - | - rsync_deploy() { - local src=$1 - local dst=$2 - local exclude=$3 - cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" - [[ -n $exclude ]] && cmd="$cmd $exclude" - cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" - echo "$cmd" - eval $cmd - } - - rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" - rsync_deploy vendor/ "$PREPROD_PATH/vendor/" - rsync_deploy kirby/ "$PREPROD_PATH/kirby/" - rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" + - TARGET_PATH=$PREPROD_PATH bash -c "$DEPLOY_SCRIPT" + variables: + DEPLOY_SCRIPT: *deploy_script From 7c0e0e47981b4a424c7cf7c2727cbb7d771e6232 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:41:56 +0200 Subject: [PATCH 03/13] improve CI --- .gitlab-ci.yml | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50ba152..dd08c82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,10 +2,6 @@ stages: - build - deploy -variables: - COMPOSER_ALLOW_SUPERUSER: '1' - SSH_PORT: '2244' - build: stage: build image: composer:2 @@ -24,29 +20,6 @@ build: paths: - node_modules/ -.deploy_script: &deploy_script | - cd dist - if [ ! -d "vendor" ]; then - echo "Error: vendor/ not found in dist (composer install may have failed)" - exit 1 - fi - - rsync_deploy() { - local src=$1 - local dst=$2 - local exclude=$3 - cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" - [[ -n $exclude ]] && cmd="$cmd $exclude" - cmd="$cmd -e 'ssh -p $SSH_PORT -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" - echo "$cmd" - eval $cmd - } - - rsync_deploy site/ "$TARGET_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" - rsync_deploy vendor/ "$TARGET_PATH/vendor/" - rsync_deploy kirby/ "$TARGET_PATH/kirby/" - rsync_deploy assets/ "$TARGET_PATH/assets/" "--exclude 'tiles/'" - deploy_prod: stage: deploy image: node:latest @@ -56,9 +29,12 @@ deploy_prod: before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - - TARGET_PATH=$PROD_PATH bash -c "$DEPLOY_SCRIPT" - variables: - DEPLOY_SCRIPT: *deploy_script + - cd dist + - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi + - rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PROD_PATH/site/ + - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PROD_PATH/vendor/ + - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PROD_PATH/kirby/ + - rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PROD_PATH/assets/ deploy_preprod: stage: deploy @@ -69,6 +45,9 @@ deploy_preprod: before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - - TARGET_PATH=$PREPROD_PATH bash -c "$DEPLOY_SCRIPT" - variables: - DEPLOY_SCRIPT: *deploy_script + - cd dist + - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi + - rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PREPROD_PATH/site/ + - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PREPROD_PATH/vendor/ + - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PREPROD_PATH/kirby/ + - rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PREPROD_PATH/assets/ From e5a3f7b8126f7a4541eb1f2726cce64ea23884a3 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:43:29 +0200 Subject: [PATCH 04/13] imperove CI --- .gitlab-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd08c82..35f4c9e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,10 +31,10 @@ deploy_prod: script: - cd dist - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi - - rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PROD_PATH/site/ - - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PROD_PATH/vendor/ - - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PROD_PATH/kirby/ - - rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PROD_PATH/assets/ + - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PROD_PATH/site/ + - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PROD_PATH/vendor/ + - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PROD_PATH/kirby/ + - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PROD_PATH/assets/ deploy_preprod: stage: deploy @@ -47,7 +47,7 @@ deploy_preprod: script: - cd dist - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi - - rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PREPROD_PATH/site/ - - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PREPROD_PATH/vendor/ - - rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PREPROD_PATH/kirby/ - - rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PREPROD_PATH/assets/ + - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PREPROD_PATH/site/ + - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PREPROD_PATH/vendor/ + - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PREPROD_PATH/kirby/ + - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PREPROD_PATH/assets/ From 22407bd9b22b2e40b0b11813ba15c32904c1cccc Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:47:21 +0200 Subject: [PATCH 05/13] improve CI --- .gitlab-ci.yml | 73 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35f4c9e..cf749df 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,13 +2,38 @@ stages: - build - deploy -build: +variables: + COMPOSER_ALLOW_SUPERUSER: '1' + +build_prod: stage: build + only: + - prod image: composer:2 script: - apk add --no-cache nodejs npm - npm install - - if [ "$CI_COMMIT_REF_NAME" = "preprod" ]; then npm run build:preprod; else npm run build; fi + - npm run build + - cd dist + - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd + - cd .. + artifacts: + paths: + - dist/ + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + +build_preprod: + stage: build + only: + - preprod + image: composer:2 + script: + - apk add --no-cache nodejs npm + - npm install + - npm run build:preprod - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -23,31 +48,51 @@ build: deploy_prod: stage: deploy image: node:latest - needs: ['build'] only: - main before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - cd dist - - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi - - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PROD_PATH/site/ - - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PROD_PATH/vendor/ - - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PROD_PATH/kirby/ - - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PROD_PATH/assets/ + - | + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$PROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$PROD_PATH/vendor/" + rsync_deploy kirby/ "$PROD_PATH/kirby/" + rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" deploy_preprod: stage: deploy image: node:latest - needs: ['build'] only: - preprod before_script: - apt-get update -qq && apt-get install -y rsync sshpass script: - cd dist - - if [ ! -d "vendor" ]; then echo "Error: vendor/ not found"; exit 1; fi - - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" site/ $USERNAME@$HOST:$PREPROD_PATH/site/ - - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" vendor/ $USERNAME@$HOST:$PREPROD_PATH/vendor/ - - sshpass -p "$PASSWORD" rsync -az --delete -O -e "ssh -p 2244 -o StrictHostKeyChecking=no" kirby/ $USERNAME@$HOST:$PREPROD_PATH/kirby/ - - sshpass -p "$PASSWORD" rsync -az --delete -O --exclude 'tiles/' -e "ssh -p 2244 -o StrictHostKeyChecking=no" assets/ $USERNAME@$HOST:$PREPROD_PATH/assets/ + - | + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$PREPROD_PATH/vendor/" + rsync_deploy kirby/ "$PREPROD_PATH/kirby/" + rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" From f9796be7f293daa6b54638e273ab9b93c00383a8 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:49:33 +0200 Subject: [PATCH 06/13] CI : refactor --- .gitlab-ci.yml | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cf749df..aa30802 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,15 +5,16 @@ stages: variables: COMPOSER_ALLOW_SUPERUSER: '1' -build_prod: +# PREPROD +build_preprod: stage: build only: - - prod + - preprod image: composer:2 script: - apk add --no-cache nodejs npm - npm install - - npm run build + - npm run build:preprod - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -25,15 +26,42 @@ build_prod: paths: - node_modules/ -build_preprod: - stage: build +deploy_preprod: + stage: deploy + image: node:latest only: - preprod + before_script: + - apt-get update -qq && apt-get install -y rsync sshpass + script: + - cd dist + - | + rsync_deploy() { + local src=$1 + local dst=$2 + local exclude=$3 + cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" + [[ -n $exclude ]] && cmd="$cmd $exclude" + cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" + echo "$cmd" + eval $cmd + } + + rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" + rsync_deploy vendor/ "$PREPROD_PATH/vendor/" + rsync_deploy kirby/ "$PREPROD_PATH/kirby/" + rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" + +# PROD +build_prod: + stage: build + only: + - prod image: composer:2 script: - apk add --no-cache nodejs npm - npm install - - npm run build:preprod + - npm run build - cd dist - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - cd .. @@ -70,29 +98,3 @@ deploy_prod: rsync_deploy vendor/ "$PROD_PATH/vendor/" rsync_deploy kirby/ "$PROD_PATH/kirby/" rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" - -deploy_preprod: - stage: deploy - image: node:latest - only: - - preprod - before_script: - - apt-get update -qq && apt-get install -y rsync sshpass - script: - - cd dist - - | - rsync_deploy() { - local src=$1 - local dst=$2 - local exclude=$3 - cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O" - [[ -n $exclude ]] && cmd="$cmd $exclude" - cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst" - echo "$cmd" - eval $cmd - } - - rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'" - rsync_deploy vendor/ "$PREPROD_PATH/vendor/" - rsync_deploy kirby/ "$PREPROD_PATH/kirby/" - rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'" From 4054c54e5782da45e6add40c22e3b106096d72a9 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:53:09 +0200 Subject: [PATCH 07/13] assign default values --- src/components/Menu.vue | 8 ++++---- src/stores/projects.js | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 6b09277..4b99489 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -127,9 +127,9 @@ const { page } = storeToRefs(usePageStore()); const unreadNotificationsCount = computed(() => { if (!user.value) return undefined; - const count = notifications.value.filter( - (notification) => !notification.isRead - ).length; + const count = + notifications.value.filter((notification) => !notification.isRead).length || + 0; if (count === 0) return undefined; return count; }); @@ -320,7 +320,7 @@ button[aria-controls='menu'][aria-expanded='false'] align-items: center; width: 100%; min-height: 2.5rem; /* 40px */ - padding: .66rem var(--space-16); + padding: 0.66rem var(--space-16); gap: var(--space-12); border-radius: var(--rounded-lg); } diff --git a/src/stores/projects.js b/src/stores/projects.js index c61f052..5f7ff94 100644 --- a/src/stores/projects.js +++ b/src/stores/projects.js @@ -7,9 +7,11 @@ export const useProjectsStore = defineStore('projects', () => { const projects = ref(null); const currentProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'listed') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + .filter((project) => project.status === 'listed') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) || [] + ); }); const draftProjects = computed(() => { From d552b6bf5ec71ba1618fd2238abf55b68c993e4a Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 14:58:29 +0200 Subject: [PATCH 08/13] fix unreadNotification --- src/components/Menu.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Menu.vue b/src/components/Menu.vue index 4b99489..65aa5a3 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -126,12 +126,13 @@ const { isEmptyBrief } = useProjectStore(); const { page } = storeToRefs(usePageStore()); const unreadNotificationsCount = computed(() => { - if (!user.value) return undefined; + if (!user.value) return 0; + const count = - notifications.value.filter((notification) => !notification.isRead).length || - 0; - if (count === 0) return undefined; - return count; + notifications.value?.filter((notification) => !notification.isRead) + .length ?? 0; + + return count === 0 ? 0 : count; }); const mainItems = [ From fb1a86712df2c85cfd523bb814abe85a0c3eae9a Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 15:01:08 +0200 Subject: [PATCH 09/13] assign default value for projects --- src/stores/projects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stores/projects.js b/src/stores/projects.js index 5f7ff94..25c5a2f 100644 --- a/src/stores/projects.js +++ b/src/stores/projects.js @@ -9,8 +9,8 @@ export const useProjectsStore = defineStore('projects', () => { const currentProjects = computed(() => { return ( projects.value - .filter((project) => project.status === 'listed') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)) || [] + ?.filter((project) => project.status === 'listed') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] ); }); From cde0eb194318b25a6c6bbf0b01fc3571a4fe4fe9 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 15:03:27 +0200 Subject: [PATCH 10/13] assign default values for all projects --- src/stores/projects.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/stores/projects.js b/src/stores/projects.js index 25c5a2f..c372c63 100644 --- a/src/stores/projects.js +++ b/src/stores/projects.js @@ -15,15 +15,19 @@ export const useProjectsStore = defineStore('projects', () => { }); const draftProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'draft') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + ?.filter((project) => project.status === 'draft') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] + ); }); const archivedProjects = computed(() => { - return projects.value - .filter((project) => project.status === 'unlisted') - .sort((a, b) => new Date(b.modified) - new Date(a.modified)); + return ( + projects.value + ?.filter((project) => project.status === 'unlisted') + .sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? [] + ); }); const api = useApiStore(); From 4223a9d522227fe5a342e942e9adc07937020242 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 15:08:53 +0200 Subject: [PATCH 11/13] disable observer --- src/components/project/PdfViewer.vue | 69 +++++++++++++--------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/components/project/PdfViewer.vue b/src/components/project/PdfViewer.vue index 0fd8f77..4acd480 100644 --- a/src/components/project/PdfViewer.vue +++ b/src/components/project/PdfViewer.vue @@ -50,43 +50,38 @@ const currentPageIndex = ref(1); // Functions const onPdfLoaded = () => { - const wrapper = document.querySelector('.vpv-pages-inner-container'); - - const observer = new IntersectionObserver( - (entries) => { - entries.forEach((entry, index) => { - if (entry.intersectionRatio > 0.5) { - currentPageIndex.value = parseInt( - entry.target.getAttribute('aria-label').split(' ')[1] - ); - } - }); - }, - { - root: wrapper, - threshold: [0.5], - } - ); - - const observePages = () => { - const pages = document.querySelectorAll('.vpv-page-inner-container'); - pages.forEach((page) => { - if (!page.__observed__) { - observer.observe(page); - page.__observed__ = true; - } - }); - }; - - const mutationObserver = new MutationObserver(() => { - observePages(); - }); - - if (wrapper) { - mutationObserver.observe(wrapper, { childList: true, subtree: true }); - } - - observePages(); + // const wrapper = document.querySelector('.vpv-pages-inner-container'); + // const observer = new IntersectionObserver( + // (entries) => { + // entries.forEach((entry, index) => { + // if (entry.intersectionRatio > 0.5) { + // currentPageIndex.value = parseInt( + // entry.target.getAttribute('aria-label').split(' ')[1] + // ); + // } + // }); + // }, + // { + // root: wrapper, + // threshold: [0.5], + // } + // ); + // const observePages = () => { + // const pages = document.querySelectorAll('.vpv-page-inner-container'); + // pages.forEach((page) => { + // if (!page.__observed__) { + // observer.observe(page); + // page.__observed__ = true; + // } + // }); + // }; + // const mutationObserver = new MutationObserver(() => { + // observePages(); + // }); + // if (wrapper) { + // mutationObserver.observe(wrapper, { childList: true, subtree: true }); + // } + // observePages(); }; From 1e890cfa2e3c70227e021b6516da6baefa030ae3 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 15:15:38 +0200 Subject: [PATCH 12/13] uncomment observers --- src/components/project/PdfViewer.vue | 69 +++++++++++++++------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/src/components/project/PdfViewer.vue b/src/components/project/PdfViewer.vue index 4acd480..0fd8f77 100644 --- a/src/components/project/PdfViewer.vue +++ b/src/components/project/PdfViewer.vue @@ -50,38 +50,43 @@ const currentPageIndex = ref(1); // Functions const onPdfLoaded = () => { - // const wrapper = document.querySelector('.vpv-pages-inner-container'); - // const observer = new IntersectionObserver( - // (entries) => { - // entries.forEach((entry, index) => { - // if (entry.intersectionRatio > 0.5) { - // currentPageIndex.value = parseInt( - // entry.target.getAttribute('aria-label').split(' ')[1] - // ); - // } - // }); - // }, - // { - // root: wrapper, - // threshold: [0.5], - // } - // ); - // const observePages = () => { - // const pages = document.querySelectorAll('.vpv-page-inner-container'); - // pages.forEach((page) => { - // if (!page.__observed__) { - // observer.observe(page); - // page.__observed__ = true; - // } - // }); - // }; - // const mutationObserver = new MutationObserver(() => { - // observePages(); - // }); - // if (wrapper) { - // mutationObserver.observe(wrapper, { childList: true, subtree: true }); - // } - // observePages(); + const wrapper = document.querySelector('.vpv-pages-inner-container'); + + const observer = new IntersectionObserver( + (entries) => { + entries.forEach((entry, index) => { + if (entry.intersectionRatio > 0.5) { + currentPageIndex.value = parseInt( + entry.target.getAttribute('aria-label').split(' ')[1] + ); + } + }); + }, + { + root: wrapper, + threshold: [0.5], + } + ); + + const observePages = () => { + const pages = document.querySelectorAll('.vpv-page-inner-container'); + pages.forEach((page) => { + if (!page.__observed__) { + observer.observe(page); + page.__observed__ = true; + } + }); + }; + + const mutationObserver = new MutationObserver(() => { + observePages(); + }); + + if (wrapper) { + mutationObserver.observe(wrapper, { childList: true, subtree: true }); + } + + observePages(); }; From d7e96541a0df51db4e41bbb0c759ef7b0980f2d8 Mon Sep 17 00:00:00 2001 From: isUnknown Date: Wed, 8 Oct 2025 15:50:25 +0200 Subject: [PATCH 13/13] remove cache busting based on query string --- public/site/snippets/header.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/site/snippets/header.php b/public/site/snippets/header.php index f8e4f54..a35fc34 100644 --- a/public/site/snippets/header.php +++ b/public/site/snippets/header.php @@ -25,8 +25,8 @@ - - + +