feat: added minifier, added minify step to makefile, added unminify step to makefile
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Zoltan Timar
2026-02-26 22:41:58 +01:00
parent e05018d637
commit 41f75da8c3
3 changed files with 3284 additions and 2 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,6 @@
.local .local
impostor.lua impostor.lua
impostor.min.lua
impostor.unmin.lua
prompts prompts
docs docs

View File

@@ -6,9 +6,13 @@ PROJECT = impostor
ORDER = $(PROJECT).inc ORDER = $(PROJECT).inc
OUTPUT = $(PROJECT).lua OUTPUT = $(PROJECT).lua
OUTPUT_MIN = $(PROJECT).min.lua
OUTPUT_UNMIN = $(PROJECT).unmin.lua
OUTPUT_ZIP = $(PROJECT).html.zip OUTPUT_ZIP = $(PROJECT).html.zip
OUTPUT_TIC = $(PROJECT).tic OUTPUT_TIC = $(PROJECT).tic
MINIFY = minify.lua
SRC_DIR = inc SRC_DIR = inc
SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER)) SRC = $(shell sed 's|^|$(SRC_DIR)/|' $(ORDER))
@@ -39,6 +43,18 @@ $(OUTPUT): $(SRC) $(ORDER)
echo "" >> $(OUTPUT); \ echo "" >> $(OUTPUT); \
done done
minify: $(OUTPUT_MIN)
$(OUTPUT_MIN): $(OUTPUT) $(MINIFY)
@echo "==> Minifying $(OUTPUT) -> $(OUTPUT_MIN)"
@lua $(MINIFY) minify $(OUTPUT) > $(OUTPUT_MIN)
unminify: $(OUTPUT_UNMIN)
$(OUTPUT_UNMIN): $(OUTPUT) $(MINIFY)
@echo "==> Unminifying $(OUTPUT) -> $(OUTPUT_UNMIN)"
@lua $(MINIFY) unminify $(OUTPUT) > $(OUTPUT_UNMIN)
export: build export: build
@if [ -z "$(VERSION)" ]; then \ @if [ -z "$(VERSION)" ]; then \
echo "ERROR: VERSION not set!"; \ echo "ERROR: VERSION not set!"; \
@@ -156,7 +172,7 @@ export_assets:
@$(call f_export_asset_awk,WAVES,$(OUTPUT),$(ASSETS_LUA)) @$(call f_export_asset_awk,WAVES,$(OUTPUT),$(ASSETS_LUA))
clean: clean:
@rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT) @rm -f $(PROJECT)-*.tic $(PROJECT)-*.html.zip $(OUTPUT) $(OUTPUT_MIN) $(OUTPUT_UNMIN)
@echo "==> Cleaned build artifacts" @echo "==> Cleaned build artifacts"
# CI/CD Targets # CI/CD Targets
@@ -219,5 +235,5 @@ docs: build
@ldoc ${OUTPUT} -d docs @ldoc ${OUTPUT} -d docs
@echo "==> Documentation generated." @echo "==> Documentation generated."
.PHONY: all build export watch import_assets export_assets clean lint ci-version ci-export ci-upload ci-update install_precommit_hook docs .PHONY: all build minify unminify export watch import_assets export_assets clean lint ci-version ci-export ci-upload ci-update install_precommit_hook docs

3264
minify.lua Normal file

File diff suppressed because it is too large Load Diff