-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-zip.sh
More file actions
executable file
·81 lines (71 loc) · 1.97 KB
/
Copy pathbuild-zip.sh
File metadata and controls
executable file
·81 lines (71 loc) · 1.97 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
#!/bin/bash
# Build script for creating distribution zip
# Only includes production files and runtime dependencies
set -e
PLUGIN_SLUG="webberzone-code-block-highlighting"
BUILD_DIR="build"
TEMP_DIR="$BUILD_DIR/$PLUGIN_SLUG"
echo "Creating distribution zip for $PLUGIN_SLUG..."
# Clean build directory
rm -rf "$BUILD_DIR"
mkdir -p "$TEMP_DIR"
# Copy plugin files (excluding dev/build artifacts and all of vendor)
echo "Copying plugin files..."
rsync -av --exclude-from=- . "$TEMP_DIR/" <<EOF
.*
.git/
.github/
node_modules/
phpcompat-tools/
phpunit/
/build/
vendor/
dev-helpers/
dev-tools/
wporg-assets/
test-tools/
docs/
build-assets.js
*.zip
*.dist
*.yml
*.neon
composer.json
composer.lock
package.json
package-lock.json
phpstan-bootstrap.php
build-zip.sh
build-prism.js
build-prism.min.js
CODE_OF_CONDUCT.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md
PULL_REQUEST_TEMPLATE.md
CLAUDE.md
AGENTS.md
EOF
# Copy required vendor dependencies (everything in vendor/ is excluded above,
# so production runtime deps must be copied back in explicitly). Dev-only files
# such as .github workflow folders are stripped from the copies.
echo "Copying vendor dependencies..."
mkdir -p "$TEMP_DIR/vendor"
# highlight.php (server-side syntax highlighter; loaded via its own PSR-0
# autoloader, not the Composer autoloader).
if [ -d "vendor/scrivo/highlight.php" ]; then
mkdir -p "$TEMP_DIR/vendor/scrivo"
rsync -a --exclude='.github' --exclude='.git*' --exclude='README.md' --exclude='CONTRIBUTING.md' --exclude='AUTHORS.txt' --exclude='.php-cs-fixer.dist.php' vendor/scrivo/highlight.php "$TEMP_DIR/vendor/scrivo/"
else
echo "Error: vendor/scrivo/highlight.php directory not found. Run 'composer install' first." >&2
exit 1
fi
# Create zip
echo "Creating zip file..."
cd "$BUILD_DIR"
zip -r "$PLUGIN_SLUG.zip" "$PLUGIN_SLUG/" -q
echo "✓ Distribution zip created: $BUILD_DIR/$PLUGIN_SLUG.zip"
cd ..
# Show zip contents summary
echo ""
echo "Zip contents summary:"
unzip -l "$BUILD_DIR/$PLUGIN_SLUG.zip" | tail -1