diff --git a/.gitea/workflows/auto-release.yml b/.gitea/workflows/auto-release.yml index eabe619..bfcde4f 100644 --- a/.gitea/workflows/auto-release.yml +++ b/.gitea/workflows/auto-release.yml @@ -314,6 +314,21 @@ jobs: echo "Release updated: ${RELEASE_TAG} -> ${VERSION}" >> $GITHUB_STEP_SUMMARY fi + - name: "Step 7.5: Minify assets" + if: >- + steps.version.outputs.skip != 'true' + run: | + npm install --no-save terser clean-css 2>/dev/null || true + MINIFY="" + for p in "../moko-platform/build/minify.js" "scripts/minify.js"; do + [ -f "$p" ] && MINIFY="$p" && break + done + if [ -n "$MINIFY" ]; then + node "$MINIFY" src + else + echo "No minify script found — skipping" + fi + # -- Summary -------------------------------------------------------------- - name: Pipeline Summary if: always() diff --git a/.gitignore b/.gitignore index 726a684..391f47d 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,8 @@ site/ *.map *.css.map *.js.map +*.min.css +*.min.js *.tsbuildinfo # ============================================================ diff --git a/Makefile b/Makefile index 4587367..79907b1 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,22 @@ install-deps: ## Install dependencies @$(NPM) install @echo "$(COLOR_GREEN)✓ Dependencies installed$(COLOR_RESET)" +MOKO_PLATFORM ?= $(or $(wildcard ../moko-platform),$(wildcard $(HOME)/moko-platform),$(wildcard /opt/moko-platform)) +MINIFY_SCRIPT := $(MOKO_PLATFORM)/build/minify.js + +.PHONY: minify +minify: ## Minify CSS/JS assets + @echo "Minifying assets..." + @if [ -f "$(MINIFY_SCRIPT)" ]; then \ + node "$(MINIFY_SCRIPT)" $(SRC_DIR); \ + elif [ -f "scripts/minify.js" ]; then \ + node scripts/minify.js; \ + else \ + echo "No minify script found"; \ + fi + .PHONY: build -build: ## Build TypeScript +build: minify ## Build TypeScript @$(NPM) run build @echo "$(COLOR_GREEN)✓ Build complete$(COLOR_RESET)"