-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodepulse.sh
More file actions
executable file
·202 lines (162 loc) · 4.27 KB
/
codepulse.sh
File metadata and controls
executable file
·202 lines (162 loc) · 4.27 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/bash
# CodePulse - Interface Unifiée de Gestion
# Usage: ./codepulse.sh [command] [options]
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
print_help() {
echo -e "${BLUE}CodePulse - Interface de Gestion${NC}"
echo "================================="
echo ""
echo "Usage: $0 [command] [options]"
echo ""
echo -e "${YELLOW}Applications:${NC}"
echo " desktop Lancer l'application desktop"
echo " web Lancer l'application web"
echo ""
echo -e "${YELLOW}Développement:${NC}"
echo " setup Configuration initiale du projet"
echo " icons Générer les icônes de développement"
echo " build Build Codepulse"
echo " test Lancer tous les tests"
echo ""
echo -e "${YELLOW}Utilitaires:${NC}"
echo " clean Nettoyer les fichiers temporaires"
echo " help Afficher cette aide"
echo ""
echo "Exemples:"
echo " $0 desktop # Lancer l'app desktop"
echo " $0 web # Lancer la landing page"
}
check_dependencies() {
echo -e "${BLUE}Vérification des dépendances...${NC}"
# Node.js
if ! command -v node &> /dev/null; then
echo -e "${RED}❌ Node.js requis. Installez-le depuis https://nodejs.org/${NC}"
exit 1
fi
# pnpm
if ! command -v pnpm &> /dev/null; then
echo -e "${YELLOW}⚠️ pnpm non trouvé. Installation...${NC}"
npm install -g pnpm
fi
echo -e "${GREEN}✅ Dépendances OK${NC}"
}
setup_project() {
echo -e "${BLUE}Configuration initiale de CodePulse...${NC}"
check_dependencies
# Install dependencies
echo -e "${BLUE}📦 Installation des dépendances...${NC}"
pnpm install
# Generate icons
echo -e "${BLUE}🎨 Génération des icônes...${NC}"
bash scripts/create-dev-icons.sh
# Setup web env if needed
if [ ! -f "web/.env.local" ]; then
echo -e "${BLUE}⚙️ Configuration de l'environnement web...${NC}"
cp web/.env.example web/.env.local
echo -e "${YELLOW}⚠️ Éditez web/.env.local avec vos credentials${NC}"
fi
# Setup desktop env if needed
if [ ! -f "desktop/.env.local" ]; then
echo -e "${BLUE}⚙️ Configuration de l'environnement desktop...${NC}"
cp desktop/.env.example desktop/.env.local
echo -e "${YELLOW}⚠️ Éditez desktop/.env.local avec vos credentials${NC}"
fi
echo -e "${GREEN}✅ Configuration terminée !${NC}"
echo ""
echo "Commandes disponibles :"
echo " $0 desktop # Lancer l'app desktop"
echo " $0 web # Lancer l'app web"
}
run_tests() {
echo -e "${BLUE}🧪 Lancement des tests...${NC}"
# TypeScript tests
echo -e "${BLUE}▶️ Tests TypeScript...${NC}"
pnpm -w lint
# Rust tests
echo -e "${BLUE}▶️ Tests Rust...${NC}"
cd desktop/src-tauri
cargo test
cd ../../..
echo -e "${GREEN}✅ Tous les tests passent !${NC}"
}
clean_project() {
echo -e "${BLUE}🧹 Nettoyage des fichiers temporaires...${NC}"
# Clean node_modules in subdirs
find . -name "node_modules" -type d -prune -exec rm -rf {} +
# Clean build artifacts
rm -rf desktop/dist
rm -rf web/.next
rm -rf desktop/src-tauri/target
# Clean packages
rm -rf packages/*/dist
echo -e "${GREEN}✅ Nettoyage terminé !${NC}"
}
launch_desktop() {
echo -e "${BLUE}🚀 Lancement de l'application desktop...${NC}"
bash scripts/launch-desktop.sh
}
launch_web() {
echo -e "${BLUE}🌐 Lancement de l'application web...${NC}"
npx tailwindcss -i ./web/assets/tailwind.css -o ./web/assets/tailwind.generated.css --minify --content './**/*.{php,html,js}'
php -S 127.0.0.1:8080 -t web
}
build_desktop() {
echo -e "${BLUE}🔨 Build de l'application desktop...${NC}"
bash scripts/build-tauri.sh
}
generate_icons() {
echo -e "${BLUE}🎨 Génération des icônes de développement...${NC}"
bash scripts/create-dev-icons.sh
}
format_code() {
echo -e "${BLUE}🎨 Formatage du code...${NC}"
npm run format
cd desktop/src-tauri
cargo fmt
cd ../../
}
# Main command handling
case "$1" in
"desktop")
launch_desktop
;;
"web")
launch_web
;;
"dev")
launch_both
;;
"setup")
setup_project
;;
"icons")
generate_icons
;;
"build")
build_desktop
;;
"test")
run_tests
;;
"clean")
clean_project
;;
"format")
format_code
;;
"help"|"--help"|"-h"|"")
print_help
;;
*)
echo -e "${RED}❌ Commande inconnue: '$1'${NC}"
echo ""
print_help
exit 1
;;
esac