-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (57 loc) · 3.25 KB
/
Copy pathMakefile
File metadata and controls
81 lines (57 loc) · 3.25 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
.PHONY: install build dev clean clean-all test test-watch coverage lint format format-check check link-dev unlink-dev tom setup help
# ─── Setup ───────────────────────────────────────────────────────────────────
install: ## Install all dependencies
pnpm install
clean: ## Remove build artifacts and node_modules
rm -rf packages/*/dist packages/*/.tsbuildinfo
@echo "Build artifacts cleaned. Run 'make clean-all' to also remove node_modules."
clean-all: clean ## Remove build artifacts and node_modules
rm -rf node_modules packages/*/node_modules pnpm-lock.yaml
@echo "Full clean. Run 'make install' to reinstall."
# ─── Build ───────────────────────────────────────────────────────────────────
build: ## Build all packages
pnpm -r build
dev: ## Watch mode — rebuild on changes
pnpm --filter ten-second-tom-core dev &
pnpm --filter ten-second-tom dev
# ─── Quality ─────────────────────────────────────────────────────────────────
test: ## Run all tests
pnpm vitest run
test-watch: ## Run tests in watch mode
pnpm vitest
coverage: ## Run tests with coverage report
pnpm vitest run --coverage
lint: ## Run ESLint
pnpm eslint packages/
format: ## Format code with Prettier
pnpm prettier --write "packages/**/*.{ts,tsx,json}"
format-check: ## Check formatting without writing
pnpm prettier --check "packages/**/*.{ts,tsx,json}"
check: lint format-check test ## Run all checks (lint, format, tests)
# ─── Dev Convenience ─────────────────────────────────────────────────────────
link-dev: build ## Install 'tom-dev' wrapper globally for local testing
@mkdir -p $(HOME)/.local/bin
@rm -f $(HOME)/.local/bin/tom-dev
@printf '%s\n' \
'#!/usr/bin/env sh' \
'export TOM_HOME="$${TOM_HOME:-$$HOME/.tom-dev}"' \
'exec node "$(CURDIR)/packages/cli/dist/cli.js" "$$@"' \
> $(HOME)/.local/bin/tom-dev
@chmod +x $(HOME)/.local/bin/tom-dev
@echo ""
@echo " 'tom-dev' now runs your local build."
@echo " Dev config/data directory: $(HOME)/.tom-dev"
@echo " Run 'tom-dev setup' to get started."
@echo " Run 'make unlink-dev' when done."
unlink-dev: ## Remove global 'tom-dev' link
@rm -f $(HOME)/.local/bin/tom-dev
@echo " 'tom-dev' link removed."
tom: build ## Run tom CLI directly (usage: make tom ARGS="record")
@node packages/cli/dist/cli.js $(ARGS)
setup: build ## Shortcut for 'tom setup'
@node packages/cli/dist/cli.js setup
# ─── Help ────────────────────────────────────────────────────────────────────
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help