Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
165 lines (137 loc) · 7.22 KB
/
Copy pathMakefile
File metadata and controls
165 lines (137 loc) · 7.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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
PORT ?= 4017
BIND ?= 0.0.0.0
RUBY_VERSION_REQUIRED ?= 3.4
NODE_VERSION_REQUIRED ?= 22
.DEFAULT_GOAL := help
export RUBY_VERSION_REQUIRED
export NODE_VERSION_REQUIRED
# The Codex desktop shell can inherit a truncated exported Bash function for
# Midnight Commander. Dash imports it before every recipe line and prints
# syntax errors, which makes `make doctor` look broken even when checks pass.
unexport BASH_FUNC_mc%%
.PHONY: help doctor install frontend frontend-watch build test lint check-public-pages ci-local pre-release verify-release-surface verify-benchmarks verify-use-cases verify-cli-release verify-rust-snippets verify-hospital-tutorial verify-lessons-tutorial verify-deliveries-tutorial verify-fsr-tutorial start clean version
define status
@printf '\n==> %s\n' "$(1)"
endef
help:
@printf 'SolverForge.org Bridgetown site\n\n'
@printf 'Setup\n'
@printf ' make doctor Verify local Ruby, Bundler, Node, and npm\n'
@printf ' make install Install Ruby gems and Node packages\n'
@printf '\nBuild and run\n'
@printf ' make frontend Build esbuild assets\n'
@printf ' make frontend-watch Watch esbuild assets during development\n'
@printf ' make build Build frontend assets and Bridgetown output\n'
@printf ' make start Serve locally on BIND=%s PORT=%s\n' "$(BIND)" "$(PORT)"
@printf ' make clean Remove Bridgetown build output\n'
@printf '\nQuality gates\n'
@printf ' make test Build in test mode and verify worked examples\n'
@printf ' make lint Run Ruby and JavaScript syntax checks\n'
@printf ' make check-public-pages Check public copy, internal links, nav, and layout\n'
@printf ' make verify-release-surface Verify current package and app version contracts\n'
@printf ' make verify-benchmarks Verify recorded full-run benchmark evidence\n'
@printf ' make verify-use-cases Verify the use-case showcase content and assets\n'
@printf ' make verify-cli-release Install the published CLI and verify scaffold targets\n'
@printf ' make verify-rust-snippets Compile-check Rust snippets in docs\n'
@printf ' make verify-hospital-tutorial Run portable tutorial contract checks\n'
@printf ' make verify-lessons-tutorial Run portable lessons contract checks\n'
@printf ' make verify-deliveries-tutorial Run portable deliveries contract checks\n'
@printf ' make verify-fsr-tutorial Run portable FSR tutorial contract checks\n'
@printf ' make ci-local Run the same gate used by CI\n'
@printf ' make pre-release Run the release-readiness gate\n'
@printf '\nInspection\n'
@printf ' make version Print toolchain and site tool versions\n'
doctor:
$(call status,Checking required tools)
@command -v ruby >/dev/null || { printf 'missing required command: ruby\n' >&2; exit 1; }
@command -v bundle >/dev/null || { printf 'missing required command: bundle\n' >&2; exit 1; }
@command -v node >/dev/null || { printf 'missing required command: node\n' >&2; exit 1; }
@command -v npm >/dev/null || { printf 'missing required command: npm\n' >&2; exit 1; }
@ruby -e 'required = ENV.fetch("RUBY_VERSION_REQUIRED"); actual = RUBY_VERSION; abort("Ruby #{required}.x or newer required; found #{actual}") unless actual.split(".").first.to_i >= required.to_i'
@node -e 'const required = Number(process.env.NODE_VERSION_REQUIRED); const actual = Number(process.versions.node.split(".")[0]); if (actual < required) { console.error(`Node $${required}.x or newer required; found $${process.versions.node}`); process.exit(1); }'
@printf 'Ruby: '; ruby -v
@printf 'Bundler: '; bundle -v
@printf 'Node: '; node -v
@printf 'npm: '; npm -v
install:
$(call status,Installing Ruby gems)
@bundle install
$(call status,Installing Node packages)
@npm ci
frontend:
$(call status,Building frontend assets)
@bundle exec rake frontend:build
frontend-watch:
$(call status,Watching frontend assets)
@bundle exec rake frontend:dev
build: frontend
$(call status,Building Bridgetown site)
@bundle exec bridgetown build
test: frontend verify-benchmarks
$(call status,Building Bridgetown site in test mode)
@BRIDGETOWN_ENV=test bundle exec rake test
$(call status,Verifying current release documentation contracts)
@ruby scripts/verify-release-surface.rb
$(call status,Verifying use-case showcase contract)
@ruby scripts/verify-use-cases-page.rb
$(call status,Verifying hospital tutorial contract)
@ruby scripts/verify-hospital-tutorial.rb
$(call status,Verifying lessons tutorial contract)
@ruby scripts/verify-lessons-tutorial.rb
$(call status,Verifying deliveries tutorial contract)
@ruby scripts/verify-deliveries-tutorial.rb
$(call status,Verifying FSR tutorial contract)
@ruby scripts/verify-fsr-tutorial.rb
lint:
$(call status,Checking Ruby syntax)
@ruby -c Gemfile
@ruby -c Rakefile
@find . \( -path './.git' -o -path './.bridgetown-cache' -o -path './node_modules' -o -path './output' -o -path './vendor' \) -prune -o -name '*.rb' -print0 | xargs -0 -n 1 ruby -c
$(call status,Checking JavaScript syntax)
@find . \( -path './.git' -o -path './.bridgetown-cache' -o -path './node_modules' -o -path './output' -o -path './vendor' \) -prune -o \( -name '*.js' -o -name '*.mjs' \) -print0 | xargs -0 -n 1 node --check
check-public-pages:
$(call status,Checking public page copy, links, nav, and layout)
@node scripts/check-public-pages.mjs
ci-local: doctor lint verify-release-surface verify-benchmarks verify-use-cases verify-rust-snippets build check-public-pages verify-hospital-tutorial verify-lessons-tutorial verify-deliveries-tutorial verify-fsr-tutorial
pre-release: verify-cli-release ci-local
$(call status,Ready for release)
verify-cli-release:
$(call status,Verifying published solverforge-cli release)
@ruby scripts/verify-cli-release.rb
verify-release-surface:
$(call status,Verifying current release documentation contracts)
@ruby scripts/verify-release-surface.rb
verify-benchmarks:
$(call status,Verifying recorded full-run benchmark evidence)
@ruby scripts/verify-benchmarks.rb
verify-use-cases:
$(call status,Verifying the use-case showcase contract)
@ruby scripts/verify-use-cases-page.rb
verify-rust-snippets:
$(call status,Verifying Rust documentation snippets)
@ruby scripts/verify-rust-snippets.rb
verify-hospital-tutorial:
$(call status,Verifying hospital tutorial contract)
@ruby scripts/verify-hospital-tutorial.rb
verify-lessons-tutorial:
$(call status,Verifying lessons tutorial contract)
@ruby scripts/verify-lessons-tutorial.rb
verify-deliveries-tutorial:
$(call status,Verifying deliveries tutorial contract)
@ruby scripts/verify-deliveries-tutorial.rb
verify-fsr-tutorial:
$(call status,Verifying FSR tutorial contract)
@ruby scripts/verify-fsr-tutorial.rb
start:
$(call status,Starting Bridgetown on $(BIND):$(PORT))
@bundle exec bridgetown start -P $(PORT) -B $(BIND)
clean:
$(call status,Cleaning Bridgetown output)
@bundle exec bridgetown clean
version:
$(call status,Tool versions)
@printf 'Ruby: '; ruby -v
@printf 'Bundler: '; bundle -v
@printf 'Node: '; node -v
@printf 'npm: '; npm -v
@printf 'Bridgetown: '; bundle exec bridgetown -v