Skip to content

Commit a8cfde0

Browse files
dev: update practicalli makefile tasks for mkdocs
1 parent 12cc61f commit a8cfde0

File tree

1 file changed

+43
-36
lines changed

1 file changed

+43
-36
lines changed

Makefile

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -------------------------------------- #
2-
# Practicalli: Makefile
2+
# Practicalli Makefile
33
#
44
# Consistent set of targets to support local book development
55
# -------------------------------------- #
@@ -8,49 +8,39 @@
88
# .PHONY: ensures target used rather than matching file name
99
# https://makefiletutorial.com/#phony
1010
.PHONY: all clean docs lint pre-commit-check test
11-
# -- Makefile Variables ---------------- #
11+
# -------------------------------------- #
1212

1313
# -- Makefile Variables ---------------- #
1414
# run help if no target specified
1515
.DEFAULT_GOAL := help
16-
SHELL := /usr/bin/zsh
17-
1816
# Column the target description is printed from
1917
HELP-DESCRIPTION-SPACING := 24
2018

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

27-
# -- Help ------------------------------ #
28-
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
29-
30-
help: ## Describe available tasks in Makefile
31-
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
32-
sort | \
33-
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
34-
# -------------------------------------- #
35-
36-
37-
# ------ Quality Checks -------------- #
27+
# -- Quality Checks ------------------ #
3828
pre-commit-check: lint
3929

4030
lint: ## Run MegaLinter with custom configuration (node.js required)
41-
$(info --------- MegaLinter Runner ---------)
31+
$(info -- MegaLinter Runner ---------------------)
4232
$(MEGALINTER_RUNNER)
4333

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

4838
lint-clean: ## Clean MegaLinter report information
49-
$(info --------- MegaLinter Clean Reports ---------)
39+
$(info -- MegaLinter Clean Reports --------------)
5040
- rm -rf ./megalinter-reports
5141

5242
megalinter-upgrade: ## Upgrade MegaLinter config to latest version
53-
$(info --------- MegaLinter Upgrade Config ---------)
43+
$(info -- MegaLinter Upgrade Config -------------)
5444
npx mega-linter-runner@latest --upgrade
5545

5646
dependencies-outdated: ## Report new versions of library dependencies and GitHub action
@@ -62,29 +52,18 @@ dependencies-update: ## Update all library dependencies and GitHub action
6252
- clojure -T:update/dependency-versions > $(OUTDATED_FILE)
6353
# -------------------------------------- #
6454

65-
# ------- Version Control -------------- #
66-
git-sr: ## status list of git repos under current directory
67-
$(info -- Multiple Git Repo Status --------------)
68-
mgitstatus -e --flatten
69-
70-
git-status: ## status details of git repos under current directory
71-
$(info -- Multiple Git Status -------------------)
72-
mgitstatus
73-
# -------------------------------------- #
74-
7555
# --- Documentation Generation -------- #
76-
7756
python-venv: ## Create Python Virtual Environment
7857
$(info -- Create Python Virtual Environment -----)
7958
python3 -m venv ~/.local/venv
8059

81-
python-venv-activate: ## Active Python Virtual Environment
60+
python-activate: ## Activate Python Virtual Environment for MkDocs
8261
$(info -- Mkdocs Local Server -------------------)
8362
source ~/.local/venv/bin/activate
8463

8564
mkdocs-install:
8665
$(info -- Install Material for MkDocs -----------)
87-
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
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
8867

8968
docs: ## Build and run mkdocs in local server (python venv)
9069
$(info -- MkDocs Local Server -------------------)
@@ -95,7 +74,35 @@ docs-changed: ## Build only changed files and run mkdocs in local server (pytho
9574
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) --dirtyreload
9675

9776
docs-build: ## Build mkdocs (python venv)
98-
$(info -- Mkdocs Local Server -------------------)
77+
$(info -- Mkdocs Build Website ------------------)
9978
source ~/.local/venv/bin/activate && mkdocs build
79+
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 -------------------- #
100+
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
101+
102+
help: ## Describe available tasks in Makefile
103+
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
104+
sort | \
105+
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
100106
# -------------------------------------- #
101107

108+
dist: deps-build ## Build mkdocs website

0 commit comments

Comments
 (0)