Files
cannaiq/wordpress-plugin/build-plugin.sh
Kelly 37dfea25e1 feat: WordPress plugin versioning + heatmap fix + dynamic latest download
- Add VERSION file (1.5.4) for tracking WP plugin version
- Update plugin headers to 1.5.4 (cannaiq-menus.php, crawlsy-menus.php)
- Add dynamic /downloads/cannaiq-menus-latest.zip route that auto-redirects
  to highest version (no manual symlinks needed)
- Update frontend download links to use -latest.zip
- Fix StateHeatmap.tsx to parse API values as numbers (fixes string concat bug)
- Document versioning rules in CLAUDE.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 09:43:39 -07:00

52 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# WordPress Plugin Build Script
# Builds the plugin zip with the correct naming convention: cannaiq-menus-{version}.zip
set -e
# Get the version from the main plugin file
VERSION=$(grep -oP "Version:\s*\K[0-9.]+" cannaiq-menus.php)
if [ -z "$VERSION" ]; then
echo "Error: Could not extract version from cannaiq-menus.php"
exit 1
fi
# Define paths
PLUGIN_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT_DIR="${PLUGIN_DIR}/../backend/public/downloads"
OUTPUT_FILE="cannaiq-menus-${VERSION}.zip"
echo "Building CannaIQ Menus WordPress plugin..."
echo " Version: ${VERSION}"
echo " Output: ${OUTPUT_DIR}/${OUTPUT_FILE}"
# Ensure output directory exists
mkdir -p "${OUTPUT_DIR}"
# Create the zip file (from the plugin directory)
cd "${PLUGIN_DIR}"
rm -f "${OUTPUT_DIR}/${OUTPUT_FILE}"
# Exclude old/legacy files and build script
zip -r "${OUTPUT_DIR}/${OUTPUT_FILE}" . \
-x "*.git*" \
-x "build-plugin.sh" \
-x "crawlsy-menus.php" \
-x "assets/css/crawlsy-menus.css" \
-x "assets/js/crawlsy-menus.js"
# Create/update the "latest" symlink
cd "${OUTPUT_DIR}"
rm -f cannaiq-menus-latest.zip
ln -s "${OUTPUT_FILE}" cannaiq-menus-latest.zip
echo ""
echo "Build complete!"
echo " File: ${OUTPUT_DIR}/${OUTPUT_FILE}"
echo " Size: $(ls -lh "${OUTPUT_DIR}/${OUTPUT_FILE}" | awk '{print $5}')"
echo ""
echo "Download URLs:"
echo " Versioned: https://cannaiq.co/downloads/cannaiq-menus-${VERSION}.zip"
echo " Latest: https://cannaiq.co/downloads/cannaiq-menus-latest.zip"