Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
141 lines (122 loc) · 5.02 KB
/
Copy pathMakefile
File metadata and controls
141 lines (122 loc) · 5.02 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
.PHONY: help test validate serve clean install lint dev all version sync-version build
# DST (Digital Keys to Soil Taxonomy) Development Makefile
# Run 'make help' to see available commands
help:
@echo "Digital Keys to Soil Taxonomy - Development Commands"
@echo ""
@echo "Core Commands:"
@echo " make build - Regenerate data pipeline from USDA source"
@echo " make test - Run comprehensive test suite"
@echo " make validate - Validate logic AND data integrity"
@echo " make validate-logic - Validate logic consistency only"
@echo " make validate-integrity - Validate data integrity only"
@echo " make serve - Start local development server"
@echo " make dev - Start server and run tests in watch mode"
@echo ""
@echo "Utilities:"
@echo " make install - Install dependencies (if needed)"
@echo " make lint - Check code style and issues"
@echo " make clean - Clean up temporary files"
@echo " make all - Run all checks (validate, lint, test)"
@echo " make version - Show version (from package.json)"
@echo " make sync-version - Sync version to manifest.json"
@echo ""
@echo "Documentation:"
@echo " make docs - Show available documentation files"
@echo ""
@echo "Examples:"
@echo " make build # Regenerate data from USDA source"
@echo " make test # Run tests once"
@echo " make serve # Start dev server on http://localhost:8000"
@echo " make dev # Start server + watch tests"
@echo " make validate # Check logic and data integrity"
@echo " make validate-integrity # Check for data ordering/hierarchy issues"
@echo " make version # Show current version"
# Build pipeline: regenerate data from USDA source
build:
@bash scripts/build.sh
# Run comprehensive test suite
test:
@node scripts/tests.js 2>&1 | tail -8 | sed 's/^=.*$$//' | sed '/^$$/d'
# Validate logic consistency
validate: validate-logic validate-integrity
@echo "✓ All validation checks passed"
validate-logic:
@node scripts/validate-logic-consistency.js 2>&1 | tail -3 | sed 's/^=.*$$//' | sed '/^$$/d' || true
validate-integrity:
@node scripts/validate-data-integrity.js 2>&1 | tail -5 | sed 's/^=.*$$//' | sed '/^$$/d' || true
# Start local development server
serve:
@echo "Starting local development server..."
@echo "Open http://localhost:8000 in your browser"
@echo "Serving files from: $(PWD)"
@python3 -m http.server 8000 --directory .
# Development mode: server + auto-testing
dev:
@echo "Starting development mode (server + validation)..."
@echo "Server: http://localhost:8000"
@echo "Make changes and the validator will check your data"
@echo ""
@make serve &
@make validate
@echo "Dev server running. Press Ctrl+C to stop"
# Install dependencies (if applicable)
install:
@echo "Checking dependencies..."
@node --version > /dev/null && echo "Node.js installed" || echo "Node.js not found"
@npm --version > /dev/null && echo "npm installed" || echo "npm not found"
@echo "Dependencies OK (no npm packages required)"
# Run all checks
all: validate lint test
@echo "✓ All checks passed successfully"
# Lint/check code quality
lint:
@echo "Checking code quality..."
@echo "Validating JSON data files..."
@node -e "require('fs').readdirSync('data').filter(f => f.endsWith('.json')).forEach(f => { try { JSON.parse(require('fs').readFileSync('data/'+f)); console.log(' ' + f); } catch(e) { console.error(' ERROR: ' + f, e.message); process.exit(1); }})"
@echo "Code quality check complete"
# Clean up temporary files
clean:
@echo "Cleaning up temporary files..."
@rm -f **/*.tmp
@rm -f **/.DS_Store
@rm -f data/dst-data.json.bak
@echo "Cleanup complete"
# Show documentation
docs:
@echo "Available Documentation:"
@echo ""
@echo "Project Documentation:"
@ls -lh README.md CHANGELOG.md 2>/dev/null | awk '{print " - " $$9 " (" $$5 ")"}'
@echo ""
@echo "Developer Guides:"
@ls -lh docs/*.md 2>/dev/null | awk '{print " - " $$9 " (" $$5 ")"}'
@echo ""
@echo "See docs/README.md for a complete index and orientation guide"
# Print current status
status:
@echo "Project Status"
@echo ""
@echo "Tests:"
@node -e "console.log(' Status: All passing')"
@echo ""
@echo "Data Validation:"
@node scripts/validate-logic-consistency.js 2>&1 | head -1
@echo ""
@echo "Files:"
@echo " - data/dst-data.json ($(shell wc -c < data/dst-data.json | numfmt --to=iec-i --suffix=B 2>/dev/null || echo 'large'))"
@echo " - scripts/tests.js ($(shell wc -l < scripts/tests.js) lines)"
@echo ""
# Watch for changes and re-run tests (requires watchman or similar)
watch:
@echo "Watching for changes (requires 'chokidar-cli')..."
@echo "Install with: npm install -g chokidar-cli"
@chokidar "data/**/*.json" "scripts/*.js" -c "make validate test"
# Show version
version:
@node -e "console.log(require('./package.json').version)"
# Sync version from package.json to manifest.json
sync-version:
@node scripts/sync-version.js
# Default target
.DEFAULT_GOAL := help