Files
tout-doux/Makefile
T
klemek c92f337006
TS Lint / ESLint (push) Successful in 43s
Python Lint CI / ruff-format-check (push) Successful in 53s
Python Lint CI / ruff (push) Successful in 59s
Python Lint CI / ty (push) Successful in 59s
TS Lint / Oxlint (push) Successful in 1m57s
TS Lint / TypeScript (push) Successful in 2m17s
chore: front-end
2026-06-30 18:15:14 +02:00

112 lines
2.3 KiB
Makefile

# ENV
ifeq (,$(shell which uv))
ifeq (,$(shell python3 -m uv --help||python3 -m pip install --user uv)) # detect uv install
UV ?= false
endif
UV ?= python3 -m uv
endif
ifeq (,$(shell which bun))
NPM ?= npm
endif
UV ?= uv
RUFF ?= $(UV) run --active ruff
TY ?= $(UV) run --active ty
UNITTEST ?= $(UV) run --active -m unittest
COVERAGE ?= $(UV) run --active coverage
OPEN ?= xdg-open
NPM ?= bun
# DOCS
.PHONY: help
help: ## show this message
@echo "Usage: $(MAKE) [target1] [target2] ..."
@echo ""
@echo "Commands/Targets:"
@cat $(MAKEFILE_LIST) | grep -E '(^[a-zA-Z0-9_%-]+:.*?##.*$$)|(^##)' | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
@echo ""
@echo "Environment:"
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z0-9_-]+\s*\??=.*$$' | grep -Eo '^[a-zA-Z0-9_-]+' | xargs -I {} $(MAKE) -s print-{} 2> /dev/null
.PHONY: print-%
print-%:
@echo -e '\033[32m$*\033[0m = $($*)'
# FILES
.venv: uv.lock
$(MAKE) -s uv-sync
node_modules: bun.lock
$(MAKE) -s npm-install
# ACTIONS
.PHONY: install
install: uv-sync npm-install ## install project
.PHONY: update
update: uv-upgrade npm-update ## update project dependencies
.PHONY: build
build: npm-run-build ## build static site in "dist"
.PHONY: format
format: ruff-fix ruff-format npm-run-lint-fix ## format project
.PHONY: lint
lint: ruff ruff-format-check ty npm-run-lint npm-run-type-check ## lint project
# TOOLS
.PHONY: uv-sync
uv-sync: ## uv sync
$(UV) sync --active
.PHONY: uv-update
uv-upgrade: ## uv sync upgrade
$(UV) sync --active --upgrade
.PHONY: ruff
ruff: .venv ## ruff check
$(RUFF) check
.PHONY: ruff-fix
ruff-fix: .venv ## ruff check (and fix)
$(RUFF) check --fix --unsafe-fixes
.PHONY: ruff-format
ruff-format: .venv ## ruff format
$(RUFF) format
.PHONY: ruff-format-check
ruff-format-check: .venv ## ruff format (check only)
$(RUFF) format --check
.PHONY: ty
ty: .venv ## ty check
$(TY) check
.PHONY: npm-install
npm-install: ## npm install
$(NPM) install
.PHONY: npm-update
npm-update: ## npm update
$(NPM) update
.PHONY: npm-run-%
npm-run-%: node_modules ## npm run (script)
$(NPM) run $*
.PHONY: release-%
release-%: .venv ## release major/minor/patch
$(UV) version --bump=$*
git add pyproject.toml uv.lock
git commit -m "chore: $$(uv version --short)"
git tag "release/$$(uv version --short)" -m "$$(uv version)"
$(UV) build