Makefileโข5.65 kB
.PHONY: help install dev build test test-coverage lint format type-check clean setup dist package
# $(PNPM)path
PNPM := $(HOME)/Library/pnpm/pnpm
# Default target
help: ## Show this help
@echo "๐ Hue MCP Server - Build Helper"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install dependencies with pnpm
@echo "๐ฆ Installing dependencies..."
$(PNPM) install
dev: ## Start development server
@echo "๐ Starting development server..."
$(PNPM) run dev
build: clean ## Build for production
@echo "๐จ Building for production..."
$(PNPM) run build
@echo ""
@echo "โ
Build complete!"
@echo ""
@echo "๐ Distribution files are in: ./dist/"
@echo " Main entry point: ./dist/index.js"
@echo ""
@echo "๐ To install globally (recommended):"
@echo " sudo ln -sf $(PWD)/dist/index.js /usr/local/bin/hue-mcp"
@echo ""
@echo "๐ Or copy entire project:"
@echo " sudo cp -r $(PWD) /usr/local/lib/hue-mcp"
@echo " sudo ln -sf /usr/local/lib/hue-mcp/dist/index.js /usr/local/bin/hue-mcp"
@echo ""
dist: build ## Create distribution and installation instructions
@echo "๐ฆ Creating distribution..."
@echo ""
@echo "โ
Distribution ready!"
@echo ""
@echo "๐ Recommended installation (symlink to built project):"
@echo " sudo ln -sf $(PWD)/dist/index.js /usr/local/bin/hue-mcp"
@echo ""
@echo "๐ฆ Alternative - standalone package:"
@echo " make package"
@echo ""
@echo "๐ Manual installation:"
@echo " 1. Copy project: sudo cp -r $(PWD) /usr/local/lib/hue-mcp"
@echo " 2. Install deps: cd /usr/local/lib/hue-mcp && sudo $(PNPM) install --prod"
@echo " 3. Link binary: sudo ln -sf /usr/local/lib/hue-mcp/dist/index.js /usr/local/bin/hue-mcp"
package: build ## Create standalone distributable package
@echo "๐ฆ Creating standalone package with dependencies..."
@rm -rf dist-package
@mkdir -p dist-package
@cp -r dist/* dist-package/
@cp package.json dist-package/
@cp README.md dist-package/
@cp LICENSE dist-package/
@cp pnpm-lock.yaml dist-package/ 2>/dev/null || true
@echo "#!/usr/bin/env node" > dist-package/hue-mcp
@echo "import './index.js';" >> dist-package/hue-mcp
@chmod +x dist-package/hue-mcp
@echo "๐ฆ Installing production dependencies..."
@cd dist-package && $(PNPM) install --prod --frozen-lockfile
@echo "๐ฆ Creating tarball..."
@tar -czf hue-mcp-dist.tar.gz -C dist-package .
@echo ""
@echo "โ
Standalone package created!"
@echo ""
@echo "๐ฆ Package: hue-mcp-dist.tar.gz"
@echo "๐ To install:"
@echo " sudo mkdir -p /usr/local/lib/hue-mcp"
@echo " sudo tar -xzf hue-mcp-dist.tar.gz -C /usr/local/lib/hue-mcp"
@echo " sudo ln -sf /usr/local/lib/hue-mcp/hue-mcp /usr/local/bin/hue-mcp"
test: ## Run tests
@echo "๐งช Running tests..."
$(PNPM) run test
test-coverage: ## Run tests with coverage
@echo "๐งช Running tests with coverage..."
$(PNPM) run test:coverage
@echo ""
@echo "๐ Coverage report available at: ./coverage/index.html"
lint: ## Run linting
@echo "๐ Running ESLint..."
$(PNPM) run lint
lint-fix: ## Run linting with auto-fix
@echo "๐ง Running ESLint with auto-fix..."
$(PNPM) run lint:fix
format: ## Format code with Prettier
@echo "๐
Formatting code..."
$(PNPM) run format
type-check: ## Run TypeScript type checking
@echo "๐ Running TypeScript type check..."
$(PNPM) run typecheck
setup: install ## Setup development environment
@echo "โ๏ธ Setting up development environment..."
@echo "โ
Dependencies installed"
@echo ""
@echo "๐ Hue MCP Server is ready for development!"
@echo ""
@echo "Next steps:"
@echo " make dev - Start development server"
@echo " make test - Run tests"
@echo " make build - Build for production"
setup-web: ## Launch setup wizard
@echo "๐ Launching web setup wizard..."
$(PNPM) run setup:web
setup-cli: ## Launch CLI setup
@echo "โก Launching CLI setup..."
$(PNPM) run setup
clean: ## Clean build artifacts and caches
@echo "๐งน Cleaning build artifacts..."
$(PNPM) run clean
@rm -rf coverage
@rm -rf node_modules/.cache
@rm -rf dist-package
@rm -f hue-mcp-dist.tar.gz
@echo "โ
Clean complete"
clean-all: clean ## Clean everything including node_modules
@echo "๐งน Deep cleaning (including node_modules)..."
@rm -rf node_modules
@rm -rf setup-wizard/node_modules
@echo "โ
Deep clean complete"
audit: ## Run security audit
@echo "๐ Running security audit..."
$(PNPM)audit
update: ## Update dependencies
@echo "๐ฆ Updating dependencies..."
$(PNPM)update
check: type-check lint test ## Run all checks (type-check, lint, test)
@echo ""
@echo "โ
All checks passed!"
ci: install check build ## Run CI pipeline (install, check, build)
@echo ""
@echo "โ
CI pipeline complete!"
# Development helpers
watch-test: ## Run tests in watch mode
@echo "๐ Running tests in watch mode..."
$(PNPM) run test --watch
debug: ## Build and show debug info
@echo "๐ Building with debug info..."
@make build
@echo ""
@echo "Debug Information:"
@echo "Node version: $(shell node --version)"
@echo "$(PNPM)version: $(shell $(PNPM)--version)"
@echo "Dist size: $(shell du -sh dist 2>/dev/null || echo 'not found')"
@echo "Main files:"
@find dist -name "*.js" -o -name "*.d.ts" | head -10
# Quick actions
quick-build: ## Quick build without clean
@echo "โก Quick build..."
$(PNPM) run build
serve: build ## Build and serve locally for testing
@echo "๐ Building and serving locally..."
@cd dist && python3 -m http.server 8080 || python -m SimpleHTTPServer 8080