CI Verification / Lint & Extension Integrity Check (push) Successful in 2m58s
84 lines
3.0 KiB
Makefile
84 lines
3.0 KiB
Makefile
# ==============================================================================
|
|
# 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 analyze-naps analyze-attendance
|
|
|
|
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 analyze-naps - Run nap analysis (e.g. make analyze-naps INPUT=path/to/export)"
|
|
@echo " make analyze-attendance - Run attendance analysis (e.g. make analyze-attendance INPUT=path/to/export)"
|
|
@echo " make clean - Remove the dist directory and build artifacts"
|
|
|
|
## analyze-naps: Run the nap & sleep data analyzer on any exported dataset
|
|
INPUT ?= exports/
|
|
OUTDIR ?= $(INPUT)
|
|
analyze-naps:
|
|
@python3 tools/analyze_naps.py --input $(INPUT) --outdir $(OUTDIR)
|
|
|
|
## analyze-attendance: Run the attendance & daily schedule analyzer on any exported dataset
|
|
analyze-attendance:
|
|
@python3 tools/analyze_attendance.py --input $(INPUT) --outdir $(OUTDIR)
|
|
|
|
## 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); if (m.description.length > 132) { console.error('❌ Description too long: ' + m.description.length + ' > 132'); process.exit(1); } console.log('✅ Manifest v' + m.version + ' OK (Description: ' + m.description.length + '/132 chars)');"
|
|
@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 "tools/*" \
|
|
-x "exports/*" \
|
|
-x "data/*" \
|
|
-x "test_data/*" \
|
|
-x "*_export/*" \
|
|
-x "screenshots/*" \
|
|
-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."
|