-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (67 loc) · 3.22 KB
/
Copy pathMakefile
File metadata and controls
83 lines (67 loc) · 3.22 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
# Makefile for hawk-graph — GitNexus graph explorer (static site + server).
# This is a Node.js project; the Makefile wraps npm scripts for consistency
# with the rest of the hawk-eco.
# ---------------------------------------------------------------------------
# Project metadata
# ---------------------------------------------------------------------------
NAME := hawk-graph
# ---------------------------------------------------------------------------
# Versioning
# ---------------------------------------------------------------------------
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
NODE ?= node
NPM ?= npm
# ---------------------------------------------------------------------------
# Phony declarations (alphabetical).
# ---------------------------------------------------------------------------
.PHONY: all build ci clean fmt help install lint serve test validate
# ---------------------------------------------------------------------------
# Default target.
# ---------------------------------------------------------------------------
all: validate build ## Default — validate, build.
# ---------------------------------------------------------------------------
# Build / install.
# ---------------------------------------------------------------------------
build: ## No build step needed (static site).
@echo "hawk-graph is a static site — no build step required."
install: ## Install dependencies.
$(NPM) install
# ---------------------------------------------------------------------------
# Tests / validation.
# ---------------------------------------------------------------------------
test: ## Run tests (syntax checks only).
$(MAKE) validate
validate: ## Validate JS syntax, shell scripts, and HTML.
$(NODE) --check server.js
@for f in $(shell find scripts -name '*.js' -o -name '*.sh'); do \
case "$$f" in \
*.js) $(NODE) --check "$$f" ;; \
*.sh) bash -n "$$f" ;; \
esac; \
done
# ---------------------------------------------------------------------------
# Quality gates.
# ---------------------------------------------------------------------------
fmt: ## No formatter for static site.
@echo "No formatter configured for hawk-graph."
lint: ## Run duplication detection.
npx --yes jscpd@5.0.12 --min-lines 5 --min-tokens 50 --reporters console --blame .
# ---------------------------------------------------------------------------
# Serve.
# ---------------------------------------------------------------------------
serve: ## Start the development server.
./scripts/serve.sh
# ---------------------------------------------------------------------------
# Misc.
# ---------------------------------------------------------------------------
version: ## Print the version.
@echo "Version: $(VERSION)"
clean: ## Remove caches.
rm -rf node_modules/.cache
help: ## Show this help.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
# ---------------------------------------------------------------------------
# Composite gate used by CI.
# ---------------------------------------------------------------------------
ci: validate lint ## Run everything CI runs.
@echo "All CI checks passed."