chore: makefile utilities

This commit is contained in:
2025-12-20 16:09:15 +01:00
parent f324854d42
commit 6f3ac01245
3 changed files with 46 additions and 2 deletions
+5 -1
View File
@@ -5,8 +5,12 @@ root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 2 indent_size = 4
end_of_line = lf end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true insert_final_newline = true
[Makefile]
indent_style = tab
indent_size = 2
+40
View File
@@ -0,0 +1,40 @@
ifeq ($(shell which bun &>/dev/null && echo 1 || echo 0), 1)
NPM ?= bun
endif
NPM ?= npm
.PHONY: help
help: ## show this message
@echo "Usage: make [target1] (target2) ..."
@echo ""
@echo "Commands/Targets:"
@grep -E '(^[a-zA-Z0-9_%-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
@echo ""
@echo "Environment:"
@grep -E '^[a-zA-Z0-9_-]+\s*[?:]?=.*$$' $(MAKEFILE_LIST) | grep -Eo '^[a-zA-Z0-9_-]+' | xargs -I {} make -s print-{}
.PHONY: print-%
print-%:
@echo -e '\033[32m$*\033[0m = $($*)'
build: ## build static site in "dist"
@$(NPM) run build
.PHONY: run
def: ## run dev version of static site
@$(NPM) run dev
lint: ## lint code
@$(NPM) run lint
fix: ## fix and reformat code
@$(NPM) run format
@$(NPM) run lint-fix
rebase-template: ## update code from template
@(git remote | grep template &>/dev/null) || git remote add template https://github.com/klemek/vue-boilerplate.git
git fetch template
git rebase template/master
+1 -1
View File
@@ -13,7 +13,7 @@
"build-only": "vite build", "build-only": "vite build",
"type-check": "vue-tsc --build", "type-check": "vue-tsc --build",
"lint": "eslint . --cache", "lint": "eslint . --cache",
"fix": "eslint . --fix --cache", "lint-fix": "eslint . --fix --cache",
"format": "prettier --write --experimental-cli src/" "format": "prettier --write --experimental-cli src/"
}, },
"dependencies": { "dependencies": {