-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (115 loc) · 5.48 KB
/
Copy pathMakefile
File metadata and controls
140 lines (115 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# ------------------------------------------------ #
# Practicalli Makefile
#
# Consistent set of targets to support local book development
#
# `-` before a command ignores any errors returned
# ------------------------------------------------ #
# Requirements
# - python
# - uv
# - clojure & practicalli cli config (dependency check)
# - docker (run megalinter locally)
# - mega-linter-runner
# ------------------------------------------------ #
# -- Makefile task config ------------------------ #
# .PHONY: ensures target used rather than matching file name
# https://makefiletutorial.com/#phony
.PHONY: all clean dist docs lint pre-commit-check
# ------------------------------------------------ #
# -- Makefile Variables -------------------------- #
# run help if no target specified
.DEFAULT_GOAL := help
# Column the target description is printed from
HELP-DESCRIPTION-SPACING := 24
# SHELL := /usr/bin/zsh
# Tool variables
MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
DOCS_SERVER := zensical serve --dev-addr localhost:7777
OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).md
# ------------------------------------------------ #
# -- Code Quality -------------------------------- #
pre-commit-check: lint ## Format and lint with Megalinter
lint: ## Run MegaLinter with custom configuration (node.js required)
$(info -- MegaLinter Runner ---------------------)
$(MEGALINTER_RUNNER)
lint-fix: ## Run MegaLinter with applied fixes and custom configuration (node.js required)
$(info -- MegaLinter Runner fix errors ----------)
$(MEGALINTER_RUNNER) --fix
lint-clean: ## Clean MegaLinter report information
$(info -- MegaLinter Clean Reports --------------)
- rm -rf ./megalinter-reports
megalinter-upgrade: ## Upgrade MegaLinter config to latest version
$(info -- MegaLinter Upgrade Config -------------)
npx mega-linter-runner@latest --upgrade
dependencies-outdated: ## Report new versions of library dependencies and GitHub action
$(info -- Search for outdated libraries ---------)
- clojure -T:search/outdated > $(OUTDATED_FILE)
dependencies-update: ## Update all library dependencies and GitHub action
$(info -- Search for outdated libraries ---------)
- clojure -T:update/dependency-versions > $(OUTDATED_FILE)
# ------------------------------------------------ #
# --- Documentation Generation MkDocs ------------ #
python-venv: ## Create Python Virtual Environment
$(info -- Create Python Virtual Environment -----)
python3 -m venv ~/.local/venv
python-activate: ## Activate Python Virtual Environment for MkDocs
$(info -- Mkdocs Local Server -------------------)
source ~/.local/venv/bin/activate
mkdocs-install:
$(info -- Install Material for MkDocs -----------)
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
docs: ## Build and run mkdocs in local server (python venv)
$(info -- MkDocs Local Server -------------------)
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER)
docs-changed: ## Build only changed files and run mkdocs in local server (python venv)
$(info -- Mkdocs Local Server -------------------)
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) --dirtyreload
docs-build: ## Build mkdocs (python venv)
$(info -- Mkdocs Build Website ------------------)
source ~/.local/venv/bin/activate && mkdocs build
docs-debug: ## Run mkdocs local server in debug mode (python venv)
$(info -- Mkdocs Local Server Debug -------------)
. ~/.local/venv/bin/activate; $(MKDOCS_SERVER) -v
docs-staging: ## Deploy to staging repository
$(info -- Mkdocs Staging Deploy -----------------)
source ~/.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml
# -------------------------------------- #
# --- Documentation Generation Zensical ---------- #
# docs-install: ## Install or upgrade Zensical with Catppuccin theme plugin
# uv tool install zensical --with catppuccin-zensical --upgrade
#
# docs: ## Build and run docs in local server
# $(info -- Local Server --------------------------)
# $(DOCS_SERVER)
#
# docs-open: ## Build docs, run server & open browser
# $(info -- Local Server & Browser ----------------)
# $(DOCS_SERVER) --open
#
# docs-build: ## Build docs locally
# $(info -- Build Docs Website --------------------)
# zensical build
#
# docs-debug: ## Run local server in debug mode
# $(info -- Local Server Debug --------------------)
# $(DOCS_SERVER) -v
#
# dist: docs-build ## Build Zensical website
# ------------------------------------------------ #
# -- Version Control ----------------------------- #
git-sr: ## status list of git repos under current directory
$(info -- Multiple Git Repo Status --------------)
mgitstatus -e --flatten
git-status: ## status details of git repos under current directory
$(info -- Multiple Git Status -------------------)
mgitstatus
# ------------------------------------------------ #
# -- Help ---------------------------------------- #
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
help: ## Describe available tasks in Makefile
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
sort | \
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
# ------------------------------------------------ #