-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (109 loc) · 5.02 KB
/
Makefile
File metadata and controls
142 lines (109 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
142
# frozen_string_literal: true
.PHONY: help test lint lint-js lint-ruby lintfix lintfix-js lintfix-ruby setup dev clean frontend-setup check-frontend quick-check ready yard-verify-public-docs openapi openapi-verify openapi-client openapi-client-verify openapi-lint openapi-lint-redocly openapi-lint-spectral openai-lint-spectral test-frontend-e2e
# Default target
help: ## Show this help message
@echo "html2rss-web Development Commands"
@echo "================================="
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
setup: ## Full development setup
@echo "Setting up development environment..."
bundle install
@if [ ! -f .env ]; then \
cp .env.example .env 2>/dev/null || echo "RACK_ENV=development" > .env; \
echo "Created .env file"; \
fi
@mkdir -p tmp/rack-cache-body tmp/rack-cache-meta
@echo "Setting up frontend..."
@cd frontend && CI=1 pnpm install --frozen-lockfile
@echo "Setup complete!"
dev: ## Start development server with live reload
@echo "Starting html2rss-web development environment..."
@bin/dev
dev-ruby: ## Start Ruby server only
@bin/dev-ruby
dev-frontend: ## Start frontend dev server only
@cd frontend && pnpm run dev
test: ## Run all tests (Ruby + Frontend)
bundle exec rspec
@cd frontend && pnpm run test:ci
test-ruby: ## Run Ruby tests only
bundle exec rspec
test-frontend: ## Run frontend tests only
@cd frontend && pnpm run test:ci
test-frontend-unit: ## Run frontend unit tests only
@cd frontend && pnpm run test:unit
test-frontend-contract: ## Run frontend contract tests only
@cd frontend && pnpm run test:contract
test-frontend-e2e: ## Run frontend Playwright smoke tests
@cd frontend && pnpm run test:e2e
check-frontend: ## Run frontend typecheck, format, and test checks
$(MAKE) lint-js
$(MAKE) test-frontend
lint: lint-ruby lint-js ## Run all linters (Ruby + Frontend) - errors when issues found
@echo "All linting complete!"
lint-ruby: ## Run Ruby linter (RuboCop) - errors when issues found
@echo "Running RuboCop linting..."
bundle exec rubocop
@echo "Running Zeitwerk eager-load check..."
bundle exec rake zeitwerk:verify
@echo "Running YARD public-method docs check..."
bundle exec rake yard:verify_public_docs
@echo "Ruby linting complete!"
lint-js: ## Run JavaScript/Frontend linting (TypeScript + ESLint + Stylelint + Prettier) - errors when issues found
@echo "Running TypeScript typecheck..."
@cd frontend && pnpm run typecheck
@echo "Running ESLint..."
@cd frontend && pnpm run lint
@echo "Running Stylelint..."
@cd frontend && pnpm exec stylelint "../public/shared-ui.css" "**/*.css"
@echo "Running Prettier format check..."
@cd frontend && pnpm run format:check
@echo "JavaScript linting complete!"
lintfix: lintfix-ruby lintfix-js ## Auto-fix all linting issues (Ruby + Frontend)
@echo "All lintfix complete!"
lintfix-ruby: ## Auto-fix Ruby linting issues
@echo "Running RuboCop auto-correct..."
-bundle exec rubocop --auto-correct
@echo "Ruby lintfix complete!"
lintfix-js: ## Auto-fix JavaScript/Frontend linting issues
@echo "Running ESLint auto-fix..."
@cd frontend && pnpm run lint:fix
@echo "Running Prettier formatting..."
@cd frontend && pnpm run format
@echo "JavaScript lintfix complete!"
quick-check: ## Fast local checks (Ruby lint/docs + frontend format/typecheck)
@echo "Running quick checks..."
$(MAKE) lint-ruby
$(MAKE) lint-js
@echo "Quick checks complete!"
ready: ## Pre-commit gate (quick checks + RSpec)
@echo "Running pre-commit checks..."
$(MAKE) quick-check
bundle exec rspec
@echo "Pre-commit checks complete!"
yard-verify-public-docs: ## Verify essential YARD docs for all public methods in app/
bundle exec rake yard:verify_public_docs
openapi: ## Regenerate public/openapi.yaml from request specs
bundle exec rake openapi:generate
openapi-verify: ## Regenerate OpenAPI and fail if public/openapi.yaml or frontend client is stale
bundle exec rake openapi:verify
$(MAKE) openapi-client-verify
openapi-client: ## Generate frontend OpenAPI client/types from public/openapi.yaml
@cd frontend && pnpm run openapi:generate
openapi-client-verify: ## Generate frontend OpenAPI client and fail if generated files are stale
@cd frontend && pnpm run openapi:verify
openapi-lint: openapi-lint-redocly openapi-lint-spectral ## Lint public/openapi.yaml with Redocly and Spectral
openapi-lint-redocly: ## Lint OpenAPI using Redocly recommended rules
npx --yes @redocly/cli lint --config .redocly.yaml public/openapi.yaml
openapi-lint-spectral: ## Lint OpenAPI using Spectral OAS rules
npx --yes @stoplight/spectral-cli lint --ruleset .spectral.yaml public/openapi.yaml
openai-lint-spectral: openapi-lint-spectral ## Alias for openapi-lint-spectral
clean: ## Clean temporary files
@rm -rf tmp/rack-cache-* coverage/
@cd frontend && rm -rf dist/ node_modules/
@echo "Clean complete!"
frontend-setup: ## Setup frontend dependencies
@echo "Setting up frontend dependencies..."
@cd frontend && CI=1 pnpm install --frozen-lockfile
@echo "Frontend setup complete!"