mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-22 15:55:09 +00:00
chore: add Makefile
Includes the following targets: - `make lint` → Run pre-commit hook for trailing whitespace - `make format` → Apply Prettier formatting across the repo - `make push` → Add, commit (with prompt), and push changes - `make amend` → Amend the last commit without editing message - `make help` → Show usage guide Also includes optional extras like hook installation and reset utilities.
This commit is contained in:
parent
f2a579775d
commit
a94b12dfc4
2 changed files with 49 additions and 2 deletions
3
.github/workflows/semantic-release.yml
vendored
3
.github/workflows/semantic-release.yml
vendored
|
|
@ -42,7 +42,7 @@ jobs:
|
|||
OUTPUT=$(npx semantic-release 2>&1)
|
||||
STATUS=$?
|
||||
echo "$OUTPUT" | tee /dev/stderr
|
||||
|
||||
|
||||
if [[ $STATUS -eq 0 ]]; then
|
||||
# Extract release tag
|
||||
RELEASE_TAG=$(echo "$OUTPUT" | grep -oP '(?<=next release version is )[^ ]+')
|
||||
|
|
@ -55,4 +55,3 @@ jobs:
|
|||
echo "❌ semantic-release failed with unexpected error (exit $STATUS)."
|
||||
exit $STATUS
|
||||
fi
|
||||
|
||||
|
|
|
|||
48
Makefile
Normal file
48
Makefile
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Default help formatter
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
# Colors
|
||||
GREEN := \033[0;32m
|
||||
RESET := \033[0m
|
||||
|
||||
# Help generator (targets with ##)
|
||||
help: ## Show this help message
|
||||
@echo ""
|
||||
@echo "$(GREEN)Available make commands:$(RESET)"
|
||||
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
||||
| sort \
|
||||
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||
@echo ""
|
||||
|
||||
# 1. Pre-commit check: trailing whitespace only
|
||||
lint: ## Run pre-commit check for trailing whitespace
|
||||
pre-commit run trailing-whitespace --all-files
|
||||
|
||||
# 2. Format all files with prettier
|
||||
format: ## Run Prettier on the whole repo
|
||||
npx prettier --write .
|
||||
|
||||
# 3a-c. Stage, commit & push
|
||||
push: ## Add all files, commit (ask for message), and push
|
||||
@git add .
|
||||
@read -p "Enter commit message: " msg; \
|
||||
git commit -m "$$msg"
|
||||
@git push
|
||||
|
||||
# 4. Amend last commit (no edit)
|
||||
amend: ## Amend last commit without editing the message
|
||||
git commit --amend --no-edit
|
||||
|
||||
# Add-ons you might like:
|
||||
|
||||
check-hooks: ## Run all configured pre-commit hooks
|
||||
pre-commit run --all-files
|
||||
|
||||
install-hooks: ## Install pre-commit hooks in .git/hooks
|
||||
pre-commit install
|
||||
|
||||
reset-soft: ## Undo last commit but keep changes staged
|
||||
git reset --soft HEAD~1
|
||||
|
||||
clean: ## Remove temporary Python/node/docker files
|
||||
rm -rf __pycache__ node_modules *.pyc *.log .pytest_cache .mypy_cache
|
||||
Loading…
Reference in a new issue