diff --git a/.gitignore b/.gitignore index 654d95b..6cb7dab 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ emmy/ exports/ data/ test_data/ +dist/ *.zip *.crx diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a54162b --- /dev/null +++ b/Makefile @@ -0,0 +1,69 @@ +# ============================================================================== +# Makefile for Brightwheel Exporter Chrome Extension +# ============================================================================== + +SHELL := /usr/bin/env bash + +# Extract version from manifest.json +VERSION := $(shell node -p "require('./manifest.json').version" 2>/dev/null || echo "1.0.0") +DIST_DIR := dist +ZIP_NAME := brightwheel-exporter-v$(VERSION).zip +ZIP_PATH := $(DIST_DIR)/$(ZIP_NAME) + +.PHONY: all build zip check clean help + +all: build + +## help: Display this help message +help: + @echo "Available commands:" + @echo " make build (or make zip) - Build the Chrome Web Store production ZIP package" + @echo " make check - Verify JavaScript syntax and manifest validity" + @echo " make clean - Remove the dist directory and build artifacts" + +## check: Verify JavaScript syntax and manifest validity +check: + @echo "๐Ÿ” Validating manifest.json and JavaScript files..." + @node -e "const m = JSON.parse(require('fs').readFileSync('manifest.json')); if (m.manifest_version !== 3) process.exit(1); console.log('โœ… Manifest v' + m.version + ' OK');" + @find scripts dashboard popup -name "*.js" | while read -r jsfile; do \ + node --check "$$jsfile" && echo " โœ“ $$jsfile valid"; \ + done + @echo "โœ… All syntax checks passed!" + +## build: Package the extension into a clean production ZIP for Chrome Web Store +build: check + @echo "๐Ÿ“ฆ Packaging Chrome Extension (v$(VERSION))..." + @mkdir -p $(DIST_DIR) + @rm -f $(ZIP_PATH) + @zip -r $(ZIP_PATH) . \ + -x "*.git*" \ + -x ".githooks/*" \ + -x ".github/*" \ + -x "$(DIST_DIR)/*" \ + -x "emmy/*" \ + -x "exports/*" \ + -x "data/*" \ + -x "test_data/*" \ + -x "Makefile" \ + -x "*.md" \ + -x "LICENSE" \ + -x "*.zip" \ + -x "*.tar.gz" \ + -x "*.tmp" \ + -x ".DS_Store" \ + -x "*/.DS_Store" + @echo "" + @echo "๐ŸŽ‰ Production ZIP created successfully!" + @echo "๐Ÿ“ File location: $(ZIP_PATH)" + @echo "" + @echo "๐Ÿ“‹ ZIP Contents:" + @unzip -l $(ZIP_PATH) + +## zip: Alias for build +zip: build + +## clean: Clean build output directory +clean: + @echo "๐Ÿงน Cleaning $(DIST_DIR)..." + @rm -rf $(DIST_DIR) + @echo "Done."