-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (108 loc) · 3.44 KB
/
Makefile
File metadata and controls
134 lines (108 loc) · 3.44 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
.PHONY: all build test clean generate-clients generate-spec install dev watch help
.PHONY: build-static docker release deploy-site docker-upload build-js test-js test-js-coverage test-coverage
.PHONY: format lint check
# Default target
all: build
# Help target
help:
@echo "ToCry Build System"
@echo ""
@echo "Available targets:"
@./scripts/print_help.sh
# Install dependencies
install:
@echo "Installing Crystal dependencies..."
shards install
@echo "Installing JavaScript dependencies..."
cd src/js && npm install
# Generate OpenAPI spec from Crystal models
generate-spec:
@echo "Generating OpenAPI specification..."
crystal run src/openapi_manual.cr -- openapi.json
# Generate TypeScript and Crystal clients from OpenAPI spec
generate-clients: install
@echo "Generating API clients..."
./scripts/generate_clients.sh
# Always regenerate clients before building to ensure latest changes are included
generate-clients-force: install
@echo "Generating API clients (forced)..."
./scripts/generate_clients.sh
# Build JavaScript application only (for development)
build-js:
@echo "Building JavaScript application..."
cd src/js && npm run build
# Run JavaScript tests only
test-js:
@echo "Running JavaScript tests..."
cd src/js && npm test
# Run JavaScript tests with coverage
test-js-coverage:
@echo "Running JavaScript tests with coverage..."
cd src/js && npm run test:coverage
# Main build target - regenerates clients and builds everything
build: generate-clients-force build-js install
@echo "Building ToCry..."
shards build --release -Dinotify
# Development build (faster, no optimizations)
dev: generate-clients-force build-js
@echo "Building ToCry (development mode)..."
shards build -Dinotify
# Watch and auto-rebuild server during development
watch:
@echo "Watching for changes and running ToCry on port 3000..."
@echo "Data path: ./data"
@echo "Press Ctrl+C to stop"
@find src | entr -rn ./scripts/run_server.sh
# Run all tests (JavaScript unit, Crystal, and E2E)
test: generate-clients-force
@echo "Running all tests..."
./scripts/run_all_tests.sh
# Run JavaScript unit tests only
test-js: generate-clients-force
@echo "Running JavaScript unit tests..."
cd src/js && npm test
# Run Crystal backend tests only
test-crystal: generate-clients-force
@echo "Running Crystal backend tests..."
SKIP_JS_TESTS=true ./scripts/run_tests.sh
# Run E2E tests only
test-e2e: generate-clients-force
@echo "Running E2E tests..."
cd src/js && npm run test:e2e
# Run tests with coverage
test-coverage: test-js-coverage
@echo "Running tests with coverage..."
./scripts/run_tests.sh
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@./scripts/clean_build.sh
@echo "Cleaning JavaScript artifacts..."
cd src/js && rm -rf node_modules .parcel-cache
# Static builds for distribution
build-static: generate-clients-force build-js
@echo "Building static binaries..."
./scripts/build_static.sh
# Docker targets
docker: generate-clients-force build-js
@echo "Building Docker images..."
./scripts/upload_docker.sh
docker-upload: docker
@echo "Docker images built and pushed"
# Release management
release: build-static
@echo "Creating release..."
./scripts/do_release.sh
# Deploy website
deploy-site:
@echo "Deploying website..."
./scripts/deploy_site.sh
# Code quality targets
format:
@echo "Formatting Crystal code..."
crystal tool format
lint:
@echo "Linting Crystal code..."
@./scripts/run_lint.sh
check: lint test
@echo "All checks passed!"