BUILD_DIR := build DIST_DIR := $(BUILD_DIR)/dist OUTPUT_DIR := output CHROME_ZIP := $(OUTPUT_DIR)/chrome/redmine-reactions.zip FIREFOX_XPI := $(OUTPUT_DIR)/firefox/redmine-reactions.xpi DOCKER_COMPOSE_RUN := docker-compose run --rm builder ifneq (,$(wildcard .env)) include .env export AMO_JWT_ISSUER AMO_JWT_SECRET endif include .aibuild BUILD := $(shell echo $$(($(BUILD) + 1))) .PHONY: all chrome firefox clean all: chrome firefox chrome: build output builder aibuild @echo "==> ๐Ÿ—๏ธ Building for Chrome..." sed -e "s/AI_BUILD/$(BUILD)/" manifest-chrome.json > ./build/manifest.json $(DOCKER_COMPOSE_RUN) npm run build @echo "==> ๐Ÿ“ฆ Packaging Chrome extension..." mkdir -p $(OUTPUT_DIR)/chrome cd $(DIST_DIR) && zip -rq ../../$(CHROME_ZIP) . @echo "==> โœ… Chrome package is ready: $(CHROME_ZIP)" firefox: build output builder aibuild @echo "==> ๐Ÿ—๏ธ Building for Firefox..." sed -e "s/AI_BUILD/$(BUILD)/" manifest-firefox.json > ./build/manifest.json $(DOCKER_COMPOSE_RUN) npm run build @echo "==> โœ๏ธ Signing Firefox extension (this may take a moment)..." $(DOCKER_COMPOSE_RUN) npm run sign:firefox @echo "==> ๐Ÿšš Moving signed XPI to output..." mkdir -p $(OUTPUT_DIR)/firefox find $(BUILD_DIR)/amo -name "*.xpi" -exec mv {} $(FIREFOX_XPI) \; @echo "==> โœ… Firefox package is ready: $(FIREFOX_XPI)" aibuild: @echo BUILD=$(BUILD) > .aibuild output: mkdir output build: mkdir build builder: docker-compose build clean: @echo "==> ๐Ÿงน Cleaning up build artifacts..." rm -rf $(BUILD_DIR) $(OUTPUT_DIR)