1- # -------------------------------------- #
1+ # ------------------------------------------------ #
22# Practicalli Makefile
33#
44# Consistent set of targets to support local book development
5- # -------------------------------------- #
5+ # `-` before a command ignores any errors returned
66
7- # -- Makefile task config -------------- #
7+ # Requirements
8+ # - python
9+ # - uv
10+ # - clojure & practicalli cli config (dependency check)
11+ # - docker
12+ # - mega-linter-runner
13+ # ------------------------------------------------ #
14+
15+ # -- Makefile task config ------------------------ #
816# .PHONY: ensures target used rather than matching file name
917# https://makefiletutorial.com/#phony
10- .PHONY : all clean docs lint pre-commit-check test
11- # -------------------------------------- #
18+ .PHONY : all clean dist docs lint pre-commit-check
19+ # ------------------------------------------------ #
1220
13- # -- Makefile Variables ---------------- #
21+ # -- Makefile Variables -------------------------- #
1422# run help if no target specified
1523.DEFAULT_GOAL := help
1624# Column the target description is printed from
1725HELP-DESCRIPTION-SPACING := 24
1826
1927SHELL := /usr/bin/zsh
2028
21- # Tool Commands
29+ # Tool variables
2230MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
23- MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
31+ DOCS_SERVER := zensical serve --dev-addr localhost:7777
32+ # MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
2433OUTDATED_FILE := outdated-$(shell date +% y-% m-% d-% T) .md
25- # -------------------------------------- #
34+ # ------------------------------------------------ #
2635
27- # -- Quality Checks ------------------ #
28- pre-commit-check : lint
36+ # -- Code Quality -------------- ------------------ #
37+ pre-commit-check : lint # # Run lint task
2938
3039lint : # # Run MegaLinter with custom configuration (node.js required)
3140 $(info -- MegaLinter Runner ---------------------)
@@ -50,59 +59,46 @@ dependencies-outdated: ## Report new versions of library dependencies and GitHub
5059dependencies-update : # # Update all library dependencies and GitHub action
5160 $(info -- Search for outdated libraries ---------)
5261 - clojure -T:update/dependency-versions > $(OUTDATED_FILE )
53- # -------------------------------------- #
54-
55- # --- Documentation Generation -------- #
56- python-venv : # # Create Python Virtual Environment
57- $(info -- Create Python Virtual Environment -----)
58- python3 -m venv ~ /.local/venv
62+ # ------------------------------------------------ #
5963
60- python-activate : # # Activate Python Virtual Environment for MkDocs
61- $( info -- Mkdocs Local Server -------------------)
62- source ~ /.local/venv/bin/activate
64+ # --- Documentation Generation ------------------ #
65+ docs-install : # # Install or upgrade Zensical in Python virtual environment
66+ uv tool install zensical --upgrade
6367
64- mkdocs-install :
65- $(info -- Install Material for MkDocs -----------)
66- source ~ /.local/venv/bin/activate && pip install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects mkdocs-rss-plugin pillow cairosvg --upgrade
68+ docs : # # Build and run docs in local server
69+ $(info -- Local Server --------------- -----------)
70+ $( DOCS_SERVER )
6771
68- docs : # # Build and run mkdocs in local server (python venv)
69- $(info -- MkDocs Local Server --- ----------------)
70- source ~ /.local/venv/bin/activate && $( MKDOCS_SERVER )
72+ docs-open : # # Build docs, run server & open browser
73+ $(info -- Local Server & Browser ----------------)
74+ $( DOCS_SERVER ) --open
7175
72- docs-changed : # # Build only changed files and run mkdocs in local server (python venv)
73- $(info -- Mkdocs Local Server -------------------)
74- source ~ /.local/venv/bin/activate && $( MKDOCS_SERVER ) --dirtyreload
76+ docs-build : # # Build docs locally
77+ $(info -- Build Docs Website - -------------------)
78+ zensical build
7579
76- docs-build : # # Build mkdocs (python venv)
77- $(info -- Mkdocs Build Website ------------------)
78- source ~ /.local/venv/bin/activate && mkdocs build
80+ docs-debug : # # Run local server in debug mode
81+ $(info -- Local Server Debug -- ------------------)
82+ $( DOCS_SERVER ) -v
7983
80- docs-debug : # # Run mkdocs local server in debug mode (python venv)
81- $(info -- Mkdocs Local Server Debug -------------)
82- . ~ /.local/venv/bin/activate; $(MKDOCS_SERVER ) -v
84+ dist : docs-build # # Build mkdocs website
85+ # ------------------------------------------------ #
8386
84- docs-staging : # # Deploy to staging repository
85- $(info -- Mkdocs Staging Deploy -----------------)
86- source ~ /.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml
87- # -------------------------------------- #
88-
89- # ------- Version Control -------------- #
87+ # ------- Version Control ------------------------ #
9088git-sr : # # status list of git repos under current directory
9189 $(info -- Multiple Git Repo Status --------------)
9290 mgitstatus -e --flatten
9391
9492git-status : # # status details of git repos under current directory
9593 $(info -- Multiple Git Status -------------------)
9694 mgitstatus
97- # -------------------------------------- #
95+ # ------------------------------------------------ #
9896
99- # ------------ Help -------------------- #
97+ # -- Help -------------------- -------------------- #
10098# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
10199
102100help : # # Describe available tasks in Makefile
103101 @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
104102 sort | \
105103 awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
106- # -------------------------------------- #
107-
108- dist : deps-build # # Build mkdocs website
104+ # ------------------------------------------------ #
0 commit comments