1+ #! /bin/bash
2+
3+ # GraphDone Quick Launcher
4+ # The easiest way to get GraphDone running
5+
6+ set -e
7+
8+ # Colors for better output
9+ RED=' \033[0;31m'
10+ GREEN=' \033[0;32m'
11+ BLUE=' \033[0;34m'
12+ YELLOW=' \033[1;33m'
13+ PURPLE=' \033[0;35m'
14+ CYAN=' \033[0;36m'
15+ NC=' \033[0m' # No Color
16+
17+ # Clear screen for a clean start
18+ clear
19+
20+ echo -e " ${PURPLE} "
21+ echo " ╔══════════════════════════════════════════════════════════════╗"
22+ echo " ║ ║"
23+ echo " ║ 🌐 GraphDone 🌐 ║"
24+ echo " ║ ║"
25+ echo " ║ Graph-native project management system ║"
26+ echo " ║ ║"
27+ echo " ╚══════════════════════════════════════════════════════════════╝"
28+ echo -e " ${NC} "
29+
30+ # Function to ensure Node.js is available (same as in run.sh)
31+ ensure_nodejs () {
32+ # If node/npm not found, try to source nvm
33+ if ! command -v node & > /dev/null || ! command -v npm & > /dev/null; then
34+ echo -e " ${YELLOW} ⚠️ Node.js/npm not found in PATH, attempting to load from nvm...${NC} "
35+
36+ # Try to load nvm
37+ export NVM_DIR=" $HOME /.nvm"
38+ if [ -s " $NVM_DIR /nvm.sh" ]; then
39+ source " $NVM_DIR /nvm.sh"
40+ if [ -s " $NVM_DIR /bash_completion" ]; then
41+ source " $NVM_DIR /bash_completion"
42+ fi
43+
44+ # Use the latest installed version or 18
45+ if nvm list | grep -q " v18" ; then
46+ nvm use 18
47+ else
48+ nvm use node
49+ fi
50+
51+ echo -e " ${GREEN} ✅ Loaded Node.js from nvm: $( node --version) ${NC} "
52+ else
53+ echo -e " ${RED} ❌ Node.js not found and nvm not available.${NC} "
54+ echo " Please restart your terminal or run:"
55+ echo " source ~/.bashrc # or ~/.zshrc"
56+ echo " ./start"
57+ exit 1
58+ fi
59+ fi
60+ }
61+
62+ echo -e " ${CYAN} Welcome to GraphDone! This script will get you up and running quickly.${NC} "
63+ echo " "
64+
65+ # Ensure Node.js is available
66+ ensure_nodejs
67+
68+ # Check if setup or workspace repair is needed
69+ setup_needed=false
70+ workspace_repair_needed=false
71+
72+ if [ ! -f " packages/server/.env" ] || [ ! -f " packages/web/.env" ]; then
73+ setup_needed=true
74+ fi
75+
76+ # Check if workspace dependencies are broken
77+ if [ ! -f " packages/core/dist/index.js" ] || [ ! -L " node_modules/@graphdone/core" ] || [ ! -f " node_modules/.prisma/client/index.js" ]; then
78+ workspace_repair_needed=true
79+ fi
80+
81+ # Run setup if needed
82+ if [ " $setup_needed " = true ]; then
83+ echo -e " ${YELLOW} 🔧 First time setup detected...${NC} "
84+ echo " "
85+ echo -e " ${BLUE} Running initial setup (this may take a few minutes):${NC} "
86+ echo " • Installing dependencies"
87+ echo " • Setting up environment variables"
88+ echo " • Starting database"
89+ echo " • Running migrations"
90+ echo " • Building packages"
91+ echo " "
92+
93+ ./tools/setup.sh
94+
95+ echo " "
96+ echo -e " ${GREEN} ✅ Setup complete!${NC} "
97+ echo " "
98+ elif [ " $workspace_repair_needed " = true ]; then
99+ echo -e " ${YELLOW} 🔧 Workspace dependencies need repair...${NC} "
100+ echo " "
101+ echo -e " ${BLUE} Fixing workspace dependencies:${NC} "
102+ echo " • Rebuilding core package"
103+ echo " • Generating Prisma client"
104+ echo " • Ensuring workspace links"
105+ echo " "
106+
107+ # Quick workspace repair (less aggressive than full setup)
108+ echo -e " ${CYAN} 📦 Installing dependencies...${NC} "
109+ npm install
110+
111+ echo -e " ${CYAN} 🏗️ Building core package...${NC} "
112+ (cd packages/core && npm run build)
113+
114+ echo -e " ${CYAN} 🔧 Generating Prisma client...${NC} "
115+ (cd packages/server && npx prisma generate)
116+
117+ # Verify the fix worked
118+ if [ -f " packages/core/dist/index.js" ] && [ -L " node_modules/@graphdone/core" ]; then
119+ echo " "
120+ echo -e " ${GREEN} ✅ Workspace repair complete!${NC} "
121+ echo " "
122+ else
123+ echo " "
124+ echo -e " ${RED} ❌ Workspace repair failed. Running full setup...${NC} "
125+ echo " "
126+ ./tools/setup.sh
127+ fi
128+ fi
129+
130+ echo -e " ${BLUE} 🚀 Starting GraphDone development environment...${NC} "
131+ echo " "
132+
133+ # Start the development environment
134+ if ! ./tools/run.sh; then
135+ echo " "
136+ echo -e " ${YELLOW} ⚠️ If you see 'command not found' errors:${NC} "
137+ echo " 1. Restart your terminal"
138+ echo " 2. Or run: source ~/.bashrc (or ~/.zshrc)"
139+ echo " 3. Then try: ./start again"
140+ echo " "
141+ fi
0 commit comments