-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·99 lines (84 loc) · 2.53 KB
/
build.sh
File metadata and controls
executable file
·99 lines (84 loc) · 2.53 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
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# Build script for Functionalities plugin
# Creates a clean ZIP file with the plugin in a 'functionalities' folder
#
# Usage: ./build.sh
#
# The output ZIP will be created in the current directory.
# The ZIP contains: functionalities/ (plugin folder)
#
set -e
# Get plugin version from main file
VERSION=$(grep -m1 "Version:" functionalities.php | awk '{print $NF}')
PLUGIN_SLUG="functionalities"
BUILD_DIR="build"
ZIP_NAME="${PLUGIN_SLUG}-${VERSION}.zip"
echo "=========================================="
echo " Functionalities Build Script"
echo "=========================================="
echo ""
echo "Building ${PLUGIN_SLUG} v${VERSION}..."
echo ""
# Clean previous build and old ZIP
rm -rf "${BUILD_DIR}"
rm -f "${ZIP_NAME}"
mkdir -p "${BUILD_DIR}/${PLUGIN_SLUG}"
# Files and directories to include
INCLUDE=(
"assets"
"includes"
"languages"
"functionalities.php"
"index.php"
"readme.txt"
"uninstall.php"
"exception-urls-sample.json"
)
# Copy files to build directory
echo "Copying files..."
for item in "${INCLUDE[@]}"; do
if [ -e "$item" ]; then
cp -r "$item" "${BUILD_DIR}/${PLUGIN_SLUG}/"
echo " + $item"
else
echo " - $item (not found, skipping)"
fi
done
# Remove any .DS_Store files
find "${BUILD_DIR}" -name ".DS_Store" -type f -delete 2>/dev/null || true
# Remove any development/hidden files that might have been copied
find "${BUILD_DIR}" -name "*.map" -type f -delete 2>/dev/null || true
find "${BUILD_DIR}" -name ".gitkeep" -type f -delete 2>/dev/null || true
find "${BUILD_DIR}" -name "*.md" -type f -delete 2>/dev/null || true
# Remove CLAUDE.md files from includes
find "${BUILD_DIR}" -name "CLAUDE.md" -type f -delete 2>/dev/null || true
# Create ZIP file in current directory
echo ""
echo "Creating ZIP archive..."
cd "${BUILD_DIR}"
zip -rq "../${ZIP_NAME}" "${PLUGIN_SLUG}"
cd ..
# Clean up build directory
rm -rf "${BUILD_DIR}"
# Get file size
SIZE=$(ls -lh "${ZIP_NAME}" | awk '{print $5}')
# Count files in zip
FILE_COUNT=$(unzip -l "${ZIP_NAME}" | tail -1 | awk '{print $2}')
echo ""
echo "=========================================="
echo " Build Complete!"
echo "=========================================="
echo ""
echo " Output: ./${ZIP_NAME}"
echo " Size: ${SIZE}"
echo " Files: ${FILE_COUNT}"
echo ""
echo "The ZIP contains the plugin in a '${PLUGIN_SLUG}/' folder,"
echo "ready for distribution or manual installation."
echo ""
# Show first few entries of the ZIP
echo "ZIP contents preview:"
unzip -l "${ZIP_NAME}" | head -20
echo " ..."
echo ""