Skip to content

Commit 74b8822

Browse files
dev: update practicalli makefile for mkdocs websites
1 parent f20e3a0 commit 74b8822

File tree

1 file changed

+62
-26
lines changed

1 file changed

+62
-26
lines changed

Makefile

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,108 @@
1-
# ------------------------------------------
2-
# Practicalli: Makefile
1+
# -------------------------------------- #
2+
# Practicalli Makefile
33
#
44
# Consistent set of targets to support local book development
5-
# ------------------------------------------
5+
# -------------------------------------- #
66

7+
# -- Makefile task config -------------- #
78
# .PHONY: ensures target used rather than matching file name
89
# https://makefiletutorial.com/#phony
910
.PHONY: all clean docs lint pre-commit-check test
11+
# -------------------------------------- #
1012

11-
# ------- Makefile Variables --------- #
13+
# -- Makefile Variables ---------------- #
1214
# run help if no target specified
1315
.DEFAULT_GOAL := help
14-
SHELL := /usr/bin/zsh
15-
1616
# Column the target description is printed from
1717
HELP-DESCRIPTION-SPACING := 24
1818

19+
SHELL := /usr/bin/zsh
20+
1921
# Tool Commands
2022
MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
2123
MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
24+
OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).md
25+
# -------------------------------------- #
2226

23-
# Makefile file and directory name wildcard
24-
EDN-FILES := $(wildcard *.edn)
25-
# ------------------------------------ #
26-
27-
# ------ Quality Checks ------------ #
27+
# -- Quality Checks ------------------ #
2828
pre-commit-check: lint
2929

3030
lint: ## Run MegaLinter with custom configuration (node.js required)
31-
$(info --------- MegaLinter Runner ---------)
31+
$(info -- MegaLinter Runner ---------------------)
3232
$(MEGALINTER_RUNNER)
3333

34-
lint-fix: ## Run MegaLinter with custom configuration (node.js required)
35-
$(info --------- MegaLinter Runner ---------)
34+
lint-fix: ## Run MegaLinter with applied fixes and custom configuration (node.js required)
35+
$(info -- MegaLinter Runner fix errors ----------)
3636
$(MEGALINTER_RUNNER) --fix
3737

3838
lint-clean: ## Clean MegaLinter report information
39-
$(info --------- MegaLinter Clean Reports ---------)
39+
$(info -- MegaLinter Clean Reports --------------)
4040
- rm -rf ./megalinter-reports
4141

4242
megalinter-upgrade: ## Upgrade MegaLinter config to latest version
43-
$(info --------- MegaLinter Upgrade Config ---------)
43+
$(info -- MegaLinter Upgrade Config -------------)
4444
npx mega-linter-runner@latest --upgrade
45-
# ------------------------------------ #
4645

47-
# --- Documentation Generation ------ #
48-
python-venv: ## Enable Python Virtual Environment for MkDocs
49-
$(info --------- Mkdocs Local Server ---------)
46+
dependencies-outdated: ## Report new versions of library dependencies and GitHub action
47+
$(info -- Search for outdated libraries ---------)
48+
- clojure -T:search/outdated > $(OUTDATED_FILE)
49+
50+
dependencies-update: ## Update all library dependencies and GitHub action
51+
$(info -- Search for outdated libraries ---------)
52+
- 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
59+
60+
python-activate: ## Activate Python Virtual Environment for MkDocs
61+
$(info -- Mkdocs Local Server -------------------)
5062
source ~/.local/venv/bin/activate
5163

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
67+
5268
docs: ## Build and run mkdocs in local server (python venv)
53-
$(info --------- Mkdocs Local Server ---------)
69+
$(info -- MkDocs Local Server -------------------)
5470
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER)
5571

5672
docs-changed: ## Build only changed files and run mkdocs in local server (python venv)
57-
$(info --------- Mkdocs Local Server ---------)
73+
$(info -- Mkdocs Local Server -------------------)
5874
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) --dirtyreload
5975

6076
docs-build: ## Build mkdocs (python venv)
61-
$(info --------- Mkdocs Local Server ---------)
77+
$(info -- Mkdocs Build Website ------------------)
6278
source ~/.local/venv/bin/activate && mkdocs build
63-
# ------------------------------------ #
6479

65-
# ------------ Help ------------------ #
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
83+
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 -------------- #
90+
git-sr: ## status list of git repos under current directory
91+
$(info -- Multiple Git Repo Status --------------)
92+
mgitstatus -e --flatten
93+
94+
git-status: ## status details of git repos under current directory
95+
$(info -- Multiple Git Status -------------------)
96+
mgitstatus
97+
# -------------------------------------- #
98+
99+
# ------------ Help -------------------- #
66100
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
67101

68102
help: ## Describe available tasks in Makefile
69103
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
70104
sort | \
71105
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
72-
# ------------------------------------ #
106+
# -------------------------------------- #
107+
108+
dist: deps-build ## Build mkdocs website

0 commit comments

Comments
 (0)