-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbuild.sh
More file actions
89 lines (74 loc) · 2.48 KB
/
Copy pathbuild.sh
File metadata and controls
89 lines (74 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# eXtplorer 3 Build Script
# Creates a deployable archive
set -e
APP_NAME="extplorer3"
VERSION=$(grep 'public string $version' app/Config/App.php | sed -E "s/.*= '(.+)';/\1/")
BUILD_DIR="builds/release"
TAR_NAME="builds/${APP_NAME}-${VERSION}.tar.gz"
ZIP_NAME="builds/${APP_NAME}-${VERSION}.zip"
echo "Building ${APP_NAME} version ${VERSION}..."
# 1. Cleanup old builds
rm -rf builds/*
mkdir -p ${BUILD_DIR}
# 2. Install production dependencies
echo "Installing production dependencies..."
if command -v composer >/dev/null 2>&1; then
composer install --no-dev --optimize-autoloader --quiet
elif [ -f "composer.phar" ]; then
php composer.phar install --no-dev --optimize-autoloader --quiet
else
echo "Error: composer not found"
exit 1
fi
# 2.5 Ensure bundled frontend vendor assets exist
echo "Ensuring Ace assets..."
bash ./scripts/ensure-ace-assets.sh
# 2.6 Generate and validate runtime translation bundles
echo "Building translations..."
node ./scripts/build-i18n.js
node ./scripts/check-i18n.js
# 3. Copy files to build directory
echo "Copying files..."
cp -r app ${BUILD_DIR}/
cp -r public ${BUILD_DIR}/
cp -r resources ${BUILD_DIR}/
cp -r vendor ${BUILD_DIR}/
cp LICENSE.md ${BUILD_DIR}/
cp README.md ${BUILD_DIR}/
cp composer.json ${BUILD_DIR}/
cp .htaccess ${BUILD_DIR}/
cp nginx.conf.example ${BUILD_DIR}/
# 4. Create necessary writable structure
mkdir -p ${BUILD_DIR}/writable/cache/thumbs
mkdir -p ${BUILD_DIR}/writable/logs
mkdir -p ${BUILD_DIR}/writable/session
mkdir -p ${BUILD_DIR}/writable/uploads
mkdir -p ${BUILD_DIR}/writable/file_manager_root
mkdir -p ${BUILD_DIR}/writable/shared
mkdir -p ${BUILD_DIR}/writable/trash
touch ${BUILD_DIR}/writable/users.json
echo "[]" > ${BUILD_DIR}/writable/users.json
# Copy index.php to root if needed (CI4 usually uses public/ as root)
cp public/index.php ${BUILD_DIR}/index.php 2>/dev/null || true
# 5. Create archives
echo "Creating archives..."
cd ${BUILD_DIR}
tar -czf "../../${TAR_NAME}" .
if command -v zip >/dev/null 2>&1; then
zip -r "../../${ZIP_NAME}" . -x "*.git*" -x "node_modules*"
else
echo "Warning: zip command not found, skipping ZIP creation."
fi
cd ../..
# 6. Reinstall dev dependencies for local development
echo "Restoring dev dependencies..."
if command -v composer >/dev/null 2>&1; then
composer install --quiet
elif [ -f "composer.phar" ]; then
php composer.phar install --quiet
fi
echo "Done! Archive created: ${TAR_NAME}"
if [ -f "${ZIP_NAME}" ]; then
echo "Archive created: ${ZIP_NAME}"
fi