|
| 1 | +# Password Generator - Development Commands |
| 2 | +# Run `just --list` to see all available commands |
| 3 | + |
| 4 | +# Default recipe (run when just `just` is called) |
| 5 | +default: |
| 6 | + @just --list |
| 7 | + |
| 8 | +# ============================================================================ |
| 9 | +# Build Commands |
| 10 | +# ============================================================================ |
| 11 | + |
| 12 | +# Build the project (development) |
| 13 | +build: |
| 14 | + @echo "🔨 Building project..." |
| 15 | + npm run build |
| 16 | + |
| 17 | +# Build the project (production) |
| 18 | +build-prod: |
| 19 | + @echo "🔨 Building project (production)..." |
| 20 | + npm run build:prod |
| 21 | + |
| 22 | +# Clean build artifacts |
| 23 | +clean: |
| 24 | + @echo "🧹 Cleaning build artifacts..." |
| 25 | + npm run clean |
| 26 | + |
| 27 | +# Rebuild from scratch |
| 28 | +rebuild: clean build |
| 29 | + @echo "✅ Rebuild complete!" |
| 30 | + |
| 31 | +# ============================================================================ |
| 32 | +# Type Checking |
| 33 | +# ============================================================================ |
| 34 | + |
| 35 | +# Run TypeScript type checking |
| 36 | +typecheck: |
| 37 | + @echo "🔍 Running TypeScript typecheck..." |
| 38 | + npm run typecheck |
| 39 | + |
| 40 | +# ============================================================================ |
| 41 | +# Testing & Verification |
| 42 | +# ============================================================================ |
| 43 | + |
| 44 | +# Verify build output exists and is correct |
| 45 | +verify: |
| 46 | + @echo "🔍 Checking build output in dist/ folder..." |
| 47 | + @echo "" |
| 48 | + @echo "📄 Required files:" |
| 49 | + @test -f dist/script.js && echo " ✅ dist/script.js" || echo " ❌ dist/script.js MISSING" |
| 50 | + @test -f dist/index.html && echo " ✅ dist/index.html" || echo " ❌ dist/index.html MISSING" |
| 51 | + @test -f dist/style.css && echo " ✅ dist/style.css" || echo " ❌ dist/style.css MISSING" |
| 52 | + @test -f dist/cli/index.js && echo " ✅ dist/cli/index.js" || echo " ❌ dist/cli/index.js MISSING" |
| 53 | + @echo "" |
| 54 | + @echo "📁 Data files:" |
| 55 | + @test -d dist/data && echo " ✅ dist/data/ directory exists" || echo " ❌ dist/data/ MISSING" |
| 56 | + @test -f dist/data/diceware_words.json && echo " ✅ diceware_words.json" || echo " ❌ diceware_words.json MISSING" |
| 57 | + @test -f dist/data/adjs.json && echo " ✅ adjs.json" || echo " ❌ adjs.json MISSING" |
| 58 | + @test -f dist/data/nouns.json && echo " ✅ nouns.json" || echo " ❌ nouns.json MISSING" |
| 59 | + @echo "" |
| 60 | + @echo "📊 File sizes:" |
| 61 | + @test -f dist/script.js && du -h dist/script.js | cut -f1 | xargs echo " script.js:" || true |
| 62 | + @test -f dist/cli/index.js && du -h dist/cli/index.js | cut -f1 | xargs echo " cli/index.js:" || true |
| 63 | + @echo "" |
| 64 | + @echo "🔗 HTML script reference:" |
| 65 | + @grep -o 'src="[^"]*"' dist/index.html | head -1 || true |
| 66 | + @echo "" |
| 67 | + @echo "✅ Build verification complete!" |
| 68 | + |
| 69 | +# Test CLI tool |
| 70 | +test-cli: |
| 71 | + @echo "🧪 Testing CLI tool..." |
| 72 | + @node dist/cli/index.js pwd --len 16 --mode strong || echo "⚠️ CLI test failed (may need npm link)" |
| 73 | + |
| 74 | +# Run full test suite (typecheck + build + verify + CLI test) |
| 75 | +test: typecheck build verify test-cli |
| 76 | + @echo "" |
| 77 | + @echo "✅ All tests passed!" |
| 78 | + |
| 79 | +# Full test and deploy workflow (without actually deploying) |
| 80 | +test-deploy: typecheck build verify test-cli |
| 81 | + @echo "" |
| 82 | + @echo "📦 Checking git status..." |
| 83 | + @git status --short |
| 84 | + @echo "" |
| 85 | + @echo "✅ Build and test complete!" |
| 86 | + @echo "" |
| 87 | + @echo "To deploy:" |
| 88 | + @echo " just commit 'Build and deploy to GitHub Pages'" |
| 89 | + @echo " just push" |
| 90 | + @echo "" |
| 91 | + @echo "To test locally:" |
| 92 | + @echo " just serve" |
| 93 | + |
| 94 | +# ============================================================================ |
| 95 | +# Development Server |
| 96 | +# ============================================================================ |
| 97 | + |
| 98 | +# Start development server (serves from dist/ if exists, otherwise root) |
| 99 | +serve: |
| 100 | + @echo "🌐 Starting development server..." |
| 101 | + @echo "Server will be available at: http://localhost:8000" |
| 102 | + @echo "Press Ctrl+C to stop the server" |
| 103 | + @echo "" |
| 104 | + npm run serve:dist |
| 105 | + |
| 106 | +# Start dev server (alternative - uses server.js) |
| 107 | +start: |
| 108 | + @echo "🚀 Starting server..." |
| 109 | + npm start |
| 110 | + |
| 111 | +# ============================================================================ |
| 112 | +# Git Operations |
| 113 | +# ============================================================================ |
| 114 | + |
| 115 | +# Show git status |
| 116 | +status: |
| 117 | + @echo "📋 Git status:" |
| 118 | + @git status --short |
| 119 | + |
| 120 | +# Stage all changes |
| 121 | +stage: |
| 122 | + @echo "📦 Staging all changes..." |
| 123 | + @git add -A |
| 124 | + @git status --short |
| 125 | + |
| 126 | +# Commit changes (usage: just commit "Your message") |
| 127 | +commit MESSAGE: |
| 128 | + @echo "💾 Committing changes..." |
| 129 | + @git add -A |
| 130 | + @git commit -m {{MESSAGE}} |
| 131 | + @echo "✅ Commit created!" |
| 132 | + |
| 133 | +# Push to remote |
| 134 | +push: |
| 135 | + @echo "🚀 Pushing to remote..." |
| 136 | + @git push |
| 137 | + @echo "" |
| 138 | + @echo "✅ Push complete!" |
| 139 | + @echo "" |
| 140 | + @echo "GitHub Actions will now:" |
| 141 | + @echo " 1. Run typecheck" |
| 142 | + @echo " 2. Build the project" |
| 143 | + @echo " 3. Deploy to GitHub Pages" |
| 144 | + @echo "" |
| 145 | + @echo "Check status at: https://github.com/mytherapy-coding/Password-Generator/actions" |
| 146 | + |
| 147 | +# Full deploy workflow: build + commit + push |
| 148 | +deploy MESSAGE="Deploy updates": |
| 149 | + @echo "🚀 Starting deployment..." |
| 150 | + @just build |
| 151 | + @just commit MESSAGE={{MESSAGE}} |
| 152 | + @just push |
| 153 | + @echo "" |
| 154 | + @echo "✅ Deployment complete!" |
| 155 | + |
| 156 | +# ============================================================================ |
| 157 | +# Combined Workflows |
| 158 | +# ============================================================================ |
| 159 | + |
| 160 | +# Build, commit, and push in one command |
| 161 | +build-commit-push MESSAGE="Build and deploy": |
| 162 | + @just build |
| 163 | + @just commit MESSAGE={{MESSAGE}} |
| 164 | + @just push |
| 165 | + |
| 166 | +# Full workflow: test + build + commit + push |
| 167 | +test-build-deploy MESSAGE="Test, build, and deploy": |
| 168 | + @just test-deploy |
| 169 | + @just commit MESSAGE={{MESSAGE}} |
| 170 | + @just push |
0 commit comments