This commit is contained in:
isUnknown 2025-10-08 15:54:17 +02:00
commit 1dad073ea1
5 changed files with 61 additions and 51 deletions

View file

@ -4,15 +4,16 @@ stages:
variables: variables:
COMPOSER_ALLOW_SUPERUSER: '1' COMPOSER_ALLOW_SUPERUSER: '1'
build_prod: # PREPROD
build_preprod:
stage: build stage: build
only: only:
- prod - preprod
image: composer:2 image: composer:2
script: script:
- apk add --no-cache nodejs npm - apk add --no-cache nodejs npm
- npm install - npm install
- npm run build - npm run build:preprod
- cd dist - cd dist
- composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd
- cd .. - cd ..
@ -24,17 +25,44 @@ build_prod:
paths: paths:
- node_modules/ - node_modules/
build_preprod: deploy_preprod:
stage: build stage: deploy
image: node:latest
only: only:
- preprod - 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 image: composer:2
script: script:
- apk add --no-cache nodejs npm - apk add --no-cache nodejs npm
- npm install - npm install
- npm run build:preprod - npm run build
- cd dist - - cd dist
composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd - composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd
- cd .. - cd ..
artifacts: artifacts:
paths: paths:
@ -69,29 +97,3 @@ deploy_prod:
rsync_deploy vendor/ "$PROD_PATH/vendor/" rsync_deploy vendor/ "$PROD_PATH/vendor/"
rsync_deploy kirby/ "$PROD_PATH/kirby/" rsync_deploy kirby/ "$PROD_PATH/kirby/"
rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'" 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/'"

View file

@ -6,6 +6,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"build:preprod": "vite build --mode=staging",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {

View file

@ -3,7 +3,7 @@
$regenerateSteps = require_once(__DIR__ . '/hooks/page-update--regenerate-project-steps-cache.php'); $regenerateSteps = require_once(__DIR__ . '/hooks/page-update--regenerate-project-steps-cache.php');
return [ return [
'debug' => Dir::exists('assets/dist') ? false: true, 'debug' => $_SERVER['HTTP_HOST'] !== 'designtopack.groupe-pochet.fr',
'cache' => [ 'cache' => [
'pages' => [ 'pages' => [
'active' => true 'active' => true

View file

@ -126,12 +126,13 @@ const { isEmptyBrief } = useProjectStore();
const { page } = storeToRefs(usePageStore()); const { page } = storeToRefs(usePageStore());
const unreadNotificationsCount = computed(() => { const unreadNotificationsCount = computed(() => {
if (!user.value) return undefined; if (!user.value) return 0;
const count = notifications.value.filter(
(notification) => !notification.isRead const count =
).length; notifications.value?.filter((notification) => !notification.isRead)
if (count === 0) return undefined; .length ?? 0;
return count;
return count === 0 ? 0 : count;
}); });
const mainItems = [ const mainItems = [
@ -320,7 +321,7 @@ button[aria-controls='menu'][aria-expanded='false']
align-items: center; align-items: center;
width: 100%; width: 100%;
min-height: 2.5rem; /* 40px */ min-height: 2.5rem; /* 40px */
padding: .66rem var(--space-16); padding: 0.66rem var(--space-16);
gap: var(--space-12); gap: var(--space-12);
border-radius: var(--rounded-lg); border-radius: var(--rounded-lg);
} }

View file

@ -7,21 +7,27 @@ export const useProjectsStore = defineStore('projects', () => {
const projects = ref(null); const projects = ref(null);
const currentProjects = computed(() => { const currentProjects = computed(() => {
return projects.value return (
.filter((project) => project.status === 'listed') projects.value
.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)) ?? []
);
}); });
const draftProjects = computed(() => { const draftProjects = computed(() => {
return projects.value return (
.filter((project) => project.status === 'draft') projects.value
.sort((a, b) => new Date(b.modified) - new Date(a.modified)); ?.filter((project) => project.status === 'draft')
.sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? []
);
}); });
const archivedProjects = computed(() => { const archivedProjects = computed(() => {
return projects.value return (
.filter((project) => project.status === 'unlisted') projects.value
.sort((a, b) => new Date(b.modified) - new Date(a.modified)); ?.filter((project) => project.status === 'unlisted')
.sort((a, b) => new Date(b.modified) - new Date(a.modified)) ?? []
);
}); });
const api = useApiStore(); const api = useApiStore();