Skip to content

Commit 2189e1a

Browse files
authored
Migration to svelte 5 (#2344)
* Migrate from svelte 4 to svelte 5
1 parent 2741537 commit 2189e1a

38 files changed

+2368
-1143
lines changed

lhc_web/deploy.sh

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rm -rf ./design/defaulttheme/js/svelte/public/build/*.js
2121
rm -rf ./design/defaulttheme/js/svelte/public/build/*.js.map
2222

2323
echo "Compiling default js"
24-
gulp
24+
docker run --rm -v "$(pwd)":/app -w /app node:22 npm run build
2525

2626
echo "Cleaning up voice/video js files"
2727
rm -rf ./design/defaulttheme/widget/voice-call-operator/dist/*.js
@@ -63,11 +63,50 @@ cp -v dist/*.js ../../js/voice/ && cp -v dist/*.js.map ../../js/voice/
6363
cd ../../../../
6464

6565
echo "Svelte"
66-
cd ./design/defaulttheme/js/svelte && npm run build
66+
cd ./design/defaulttheme/js/svelte && docker run --rm -v "$(pwd)":/app -w /app node:22 npm run build
6767
cd ../../../../
6868

6969
echo "Generating JS/CSS files"
70-
php cron.php -s site_admin -c cron/util/generate_css -p 1
70+
PHP_CMD=""
71+
72+
# First check default php version
73+
if command -v php &> /dev/null; then
74+
version_id=$(php -r 'echo PHP_VERSION_ID;' 2>/dev/null)
75+
if [ "$version_id" -ge 80200 ]; then
76+
PHP_CMD="php"
77+
echo "Using default php (version ID: $version_id)"
78+
else
79+
echo "Default php version is too old (version ID: $version_id), looking for alternatives..."
80+
fi
81+
fi
82+
83+
# If default php is not suitable, try to find alternative PHP versions (8.2 or higher)
84+
if [ -z "$PHP_CMD" ]; then
85+
for version in php8.3 php8.2 php83 php82 php8.4 php84 php8.5 php85; do
86+
if command -v $version &> /dev/null; then
87+
version_id=$($version -r 'echo PHP_VERSION_ID;' 2>/dev/null)
88+
if [ "$version_id" -ge 80200 ]; then
89+
PHP_CMD="$version"
90+
echo "Using $version (version ID: $version_id)"
91+
break
92+
fi
93+
fi
94+
done
95+
fi
96+
97+
# If still no suitable PHP found, error out
98+
if [ -z "$PHP_CMD" ]; then
99+
echo "Error: Could not find PHP 8.2 or higher. Please install PHP 8.2+ or ensure it's in your PATH."
100+
echo "Tried: php, php8.3, php8.2, php83, php82"
101+
exit 1
102+
fi
103+
104+
$PHP_CMD cron.php -s site_admin -c cron/util/generate_css -p 1
71105

72106
echo "Compressing JS"
73-
gulp js-static
107+
docker run --rm -v "$(pwd)":/app -w /app node:22 npm run build:static
108+
109+
if [ -f "post_deploy.sh" ]; then
110+
echo "Running post_deploy.sh"
111+
./post_deploy.sh
112+
fi

0 commit comments

Comments
 (0)