generated from nhcarrigan/template
114 lines
3.3 KiB
Makefile
114 lines
3.3 KiB
Makefile
.PHONY: help install install-ts install-py build lint lint-ts lint-py format format-py format-check format-check-py test test-ts test-py coverage coverage-ts coverage-py clean run
|
|
|
|
# Default target - show help
|
|
help:
|
|
@echo "Available commands:"
|
|
@echo " make install - Install all dependencies (TypeScript and Python)"
|
|
@echo " make install-ts - Install TypeScript dependencies only"
|
|
@echo " make install-py - Install Python dependencies only"
|
|
@echo " make build - Build TypeScript (type check)"
|
|
@echo " make lint - Run all linters (TypeScript and Python)"
|
|
@echo " make lint-ts - Run TypeScript linter only"
|
|
@echo " make lint-py - Run Python linter only"
|
|
@echo " make format - Format Python code"
|
|
@echo " make format-check - Check Python formatting without modifying"
|
|
@echo " make test - Run all tests (TypeScript and Python)"
|
|
@echo " make test-ts - Run TypeScript tests only"
|
|
@echo " make test-py - Run Python tests only"
|
|
@echo " make coverage - Run all tests with coverage"
|
|
@echo " make coverage-ts - Run TypeScript tests with coverage"
|
|
@echo " make coverage-py - Run Python tests with coverage"
|
|
@echo " make clean - Clean build artifacts and caches"
|
|
@echo ""
|
|
@echo "Running scripts:"
|
|
@echo " make run - Interactive script runner (select language, category, script)"
|
|
@echo " make run-bash - Run a bash script (e.g., make run-bash SCRIPT=bash/adb/push.sh)"
|
|
|
|
# Install all dependencies
|
|
install: install-ts install-py
|
|
|
|
# TypeScript dependencies
|
|
install-ts:
|
|
cd typescript && pnpm install --frozen-lockfile
|
|
|
|
# Python dependencies
|
|
install-py:
|
|
cd python && uv venv
|
|
cd python && uv pip install -r requirements.txt
|
|
|
|
# Build TypeScript
|
|
build:
|
|
cd typescript && pnpm exec tsc --noEmit
|
|
|
|
# Run all linters
|
|
lint: lint-ts lint-py
|
|
|
|
# TypeScript linting
|
|
lint-ts:
|
|
cd typescript && pnpm exec eslint src --max-warnings 0
|
|
|
|
# Python linting
|
|
lint-py:
|
|
cd python && uv run ruff check .
|
|
|
|
format-ts:
|
|
cd typescript && pnpm exec eslint src --fix
|
|
|
|
# Format Python code
|
|
format: format-py
|
|
|
|
format-py:
|
|
cd python && uv run ruff format .
|
|
|
|
# Check formatting without modifying
|
|
format-check: format-check-py
|
|
|
|
format-check-py:
|
|
cd python && uv run ruff format --check .
|
|
|
|
# Run all tests
|
|
test: test-ts test-py
|
|
|
|
# Run TypeScript tests
|
|
test-ts:
|
|
cd typescript && pnpm test
|
|
|
|
# Run Python tests
|
|
test-py:
|
|
cd python && uv run pytest -v
|
|
|
|
# Run all tests with coverage
|
|
coverage: coverage-ts coverage-py
|
|
|
|
# Run TypeScript tests with coverage
|
|
coverage-ts:
|
|
cd typescript && pnpm test:coverage
|
|
|
|
# Run Python tests with coverage
|
|
coverage-py:
|
|
cd python && uv run pytest --cov=. --cov-report=term-missing -v
|
|
|
|
# Clean build artifacts and caches
|
|
clean:
|
|
rm -rf typescript/node_modules
|
|
rm -rf python/.venv
|
|
rm -rf python/.ruff_cache
|
|
find python -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
find python -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
|
|
# Interactive script runner
|
|
run:
|
|
@./run.sh
|
|
|
|
# Run a specific bash script
|
|
run-bash:
|
|
@if [ -z "$(SCRIPT)" ]; then \
|
|
echo "Please specify a script: make run-bash SCRIPT=bash/adb/push.sh"; \
|
|
exit 1; \
|
|
fi
|
|
@if [ ! -f "$(SCRIPT)" ]; then \
|
|
echo "Script not found: $(SCRIPT)"; \
|
|
exit 1; \
|
|
fi
|
|
@echo "Running bash script: $(SCRIPT)"
|
|
@op run --env-file=prod.env --no-masking -- bash "$(SCRIPT)"
|