-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·60 lines (50 loc) · 1.52 KB
/
build.sh
File metadata and controls
executable file
·60 lines (50 loc) · 1.52 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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
echo "🚀 Starting Build Process..."
# 1. Build Frontend
if [ -f "package.json" ]; then
echo "📦 Building Frontend..."
npx mix --production
else
echo "⚠️ package.json not found, skipping frontend build."
fi
# 2. Optimize Backend (Remove Dev Dependencies)
echo "🧹 Optimizing Composer for Production..."
# Using --no-dev to remove phpstan etc.
# Using --classmap-authoritative for maximum performance as discussed
composer install --no-dev --optimize-autoloader --classmap-authoritative
# 3. Create Zip
ZIP_NAME="fluent-smtp.zip"
echo "🤐 Creating $ZIP_NAME..."
# Remove previous build if exists
rm -f $ZIP_NAME
# Create the zip file excluding development files and folders
# We use -r for recursive, and -x to exclude patterns
zip -r $ZIP_NAME . \
-x "*.git*" \
-x "node_modules/*" \
-x "tests/*" \
-x "svn/*" \
-x "resources/*" \
-x "build.sh" \
-x "phpstan.neon" \
-x ".editorconfig" \
-x ".eslintrc.js" \
-x ".babelrc" \
-x "webpack.config.js" \
-x "translation.node.js" \
-x "webpack.mix.js" \
-x "package.json" \
-x "package-lock.json" \
-x "pnpm-lock.yaml" \
-x "*.DS_Store" \
-x ".gitignore" \
-x ".gitattributes" \
-x "composer.lock" \
-x "README.md"
echo "✅ Build Created: $ZIP_NAME"
# 4. Restore Dev Dependencies
echo "🔄 Restoring Dev Dependencies..."
composer install
echo "🎉 Build Complete! You can now upload $ZIP_NAME to WordPress."