feat: add comprehensive Makefile for development workflow and add module type to package.json

This commit is contained in:
Russell Ballestrini 2025-07-03 17:17:21 -04:00
parent 996069a9d9
commit e502407ced
2 changed files with 122 additions and 0 deletions

121
Makefile Normal file
View file

@ -0,0 +1,121 @@
# Makefile for ai.unturf.com project
# All commands used for testing, validation, and development
.PHONY: help format check test validate-exports validate-all clean install dev build deploy
# Default target
help:
@echo "Available commands:"
@echo " make format - Format all files with biome"
@echo " make check - Check syntax and linting with biome"
@echo " make format-check - Format and check in sequence"
@echo " make test - Run integration tests"
@echo " make validate-exports - Validate import/export consistency"
@echo " make validate-all - Run all validation checks"
@echo " make clean - Clean temporary files"
@echo " make install - Install dependencies"
@echo " make dev - Start development server"
@echo " make build - Build for production"
@echo " make deploy - Deploy to production"
@echo " make git-status - Show git status"
@echo " make git-add - Stage all changes"
@echo " make git-commit - Commit with biome formatting"
@echo " make git-push - Push to remote"
# Code formatting and linting
format:
npx biome format --write .
check:
npx biome check .
format-check: format check
# Testing and validation
test:
node integration_tests.js
validate-exports:
node validate_exports.js
validate-all: format-check validate-exports test
# Development workflow
install:
npm install
dev:
python3 -m http.server 8000
build: format-check validate-all
@echo "Build complete - all checks passed"
# Git workflow
git-status:
git status
git-add:
git add -A
git-commit: format-check
git add -A
@echo "Ready to commit - run 'git commit -m \"your message\"'"
git-push:
git push
# Deployment
deploy: build git-add
@echo "Ready to deploy - review changes and commit"
# Cleanup
clean:
rm -f .biome-cache
rm -f src/.*.swp
rm -f .DS_Store
find . -name "*.log" -delete
find . -name "node_modules" -type d -exec rm -rf {} +
# Language validation
validate-languages:
@echo "Validating language files..."
@for file in src/languages/*.js; do \
echo "Checking $$file..."; \
node -e "import('$$file').then(m => console.log('✅', '$$file', 'exports:', Object.keys(m))).catch(e => console.error('❌', '$$file', 'error:', e.message))"; \
done
# File structure validation
validate-structure:
@echo "Validating project structure..."
@test -f src/ui.js || echo "❌ Missing src/ui.js"
@test -f src/translation.js || echo "❌ Missing src/translation.js"
@test -f src/tts.js || echo "❌ Missing src/tts.js"
@test -f src/chat.js || echo "❌ Missing src/chat.js"
@test -f src/config.js || echo "❌ Missing src/config.js"
@test -d src/languages || echo "❌ Missing src/languages directory"
@echo "✅ Core files exist"
# Module size check
check-sizes:
@echo "Module sizes:"
@wc -l src/*.js | sort -n
@echo ""
@echo "Language files:"
@wc -l src/languages/*.js | sort -n
# Production checks
prod-check: format-check validate-exports validate-structure
@echo "Production readiness check complete"
# Development setup
setup: install
@echo "Development environment setup complete"
@echo "Run 'make dev' to start development server"
# Quick development cycle
quick: format-check git-add
@echo "Quick validation complete - ready to commit"
# Full CI/CD cycle
ci: clean format-check validate-all validate-structure check-sizes
@echo "CI pipeline complete"

View file

@ -1,6 +1,7 @@
{
"name": "ai.unturf.com",
"version": "1.0.0",
"type": "module",
"main": "integration_tests.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"