-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_project.sh
executable file
·49 lines (38 loc) · 1.27 KB
/
create_project.sh
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
#!/bin/bash
# Fonction pour afficher l'utilisation du script
usage() {
echo "Usage: $0 [react|angular] project_name"
exit 1
}
# Vérifier les arguments
if [ $# -ne 2 ]; then
usage
fi
FRAMEWORK=$1
PROJECT_NAME=$2
# Vérifier le framework choisi
if [ "$FRAMEWORK" != "react" ] && [ "$FRAMEWORK" != "angular" ]; then
usage
fi
# Fonction pour créer la structure de projet React
create_react_structure() {
npx create-react-app $PROJECT_NAME
cd $PROJECT_NAME || exit
mkdir -p src/components src/pages src/assets src/services
touch src/components/.gitkeep src/pages/.gitkeep src/assets/.gitkeep src/services/.gitkeep
echo "Structure de projet React créée avec succès."
}
# Fonction pour créer la structure de projet Angular
create_angular_structure() {
npx @angular/cli new $PROJECT_NAME --style=scss --routing
cd $PROJECT_NAME || exit
mkdir -p src/app/components src/app/pages src/app/assets src/app/services
touch src/app/components/.gitkeep src/app/pages/.gitkeep src/app/assets/.gitkeep src/app/services/.gitkeep
echo "Structure de projet Angular créée avec succès."
}
# Exécuter la fonction appropriée selon le framework
if [ "$FRAMEWORK" == "react" ]; then
create_react_structure
else
create_angular_structure
fi