angular-generate 2.2.6 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/angular-generate-requirements.sh +92 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,6 +86,8 @@ npm install angular-generate
|
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
---
|
|
89
|
+
> ⚠️ **Important :** Copier dans la racine du projet et lancer ce script qui fait l'installation des prérequis d'un seul coup [Télécharger](https://github.com/saloum45/angulargenerate/blob/master/angular-generate-requirements.sh).
|
|
90
|
+
|
|
89
91
|
|
|
90
92
|
## 3️⃣ Installer Angular JWT
|
|
91
93
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Arrêter le script en cas d'erreur
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
echo "🚀 Démarrage de l'installation des dépendances..."
|
|
7
|
+
|
|
8
|
+
# 1. Installer @auth0/angular-jwt
|
|
9
|
+
echo "📦 Installation de @auth0/angular-jwt..."
|
|
10
|
+
npm install @auth0/angular-jwt --force
|
|
11
|
+
|
|
12
|
+
# 2. Installer @ng-select/ng-select
|
|
13
|
+
echo "📦 Installation de @ng-select/ng-select..."
|
|
14
|
+
npm install @ng-select/ng-select --force
|
|
15
|
+
|
|
16
|
+
# 3. Installer SweetAlert2
|
|
17
|
+
echo "📦 Installation de sweetalert2..."
|
|
18
|
+
npm install sweetalert2 --force
|
|
19
|
+
|
|
20
|
+
# 4. Installer ng-bootstrap (via ng add)
|
|
21
|
+
echo "📦 Installation de @ng-bootstrap/ng-bootstrap..."
|
|
22
|
+
ng add @ng-bootstrap/ng-bootstrap --force --skip-confirmation || npm install @ng-bootstrap/ng-bootstrap --force
|
|
23
|
+
|
|
24
|
+
# 5. Installer Bootstrap et Bootstrap Icons
|
|
25
|
+
echo "📦 Installation de Bootstrap et Bootstrap Icons..."
|
|
26
|
+
npm install bootstrap bootstrap-icons --force
|
|
27
|
+
|
|
28
|
+
echo "🎨 Configuration des styles..."
|
|
29
|
+
|
|
30
|
+
# Détection du fichier de style (styles.scss ou styles.css)
|
|
31
|
+
STYLE_FILE=""
|
|
32
|
+
if [ -f "src/styles.scss" ]; then
|
|
33
|
+
STYLE_FILE="src/styles.scss"
|
|
34
|
+
elif [ -f "src/styles.css" ]; then
|
|
35
|
+
STYLE_FILE="src/styles.css"
|
|
36
|
+
else
|
|
37
|
+
# Création par défaut si aucun n'existe
|
|
38
|
+
STYLE_FILE="src/styles.scss"
|
|
39
|
+
touch "$STYLE_FILE"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Ajout des imports CSS/SCSS s'ils n'y sont pas déjà
|
|
43
|
+
IMPORTS="
|
|
44
|
+
/* Importing Bootstrap CSS */
|
|
45
|
+
@import 'bootstrap/dist/css/bootstrap.css';
|
|
46
|
+
|
|
47
|
+
/* Importing Bootstrap Icons */
|
|
48
|
+
@import 'bootstrap-icons/font/bootstrap-icons.css';
|
|
49
|
+
|
|
50
|
+
/* Importing NG-Select styles */
|
|
51
|
+
@import '@ng-select/ng-select/themes/default.theme.css';
|
|
52
|
+
"
|
|
53
|
+
|
|
54
|
+
# Vérification et ajout dans le fichier de style
|
|
55
|
+
if ! grep -q "bootstrap/dist/css/bootstrap.css" "$STYLE_FILE"; then
|
|
56
|
+
echo -e "$IMPORTS" >> "$STYLE_FILE"
|
|
57
|
+
echo "✅ Styles ajoutés à $STYLE_FILE"
|
|
58
|
+
else
|
|
59
|
+
echo "ℹ️ Les styles sont déjà présents dans $STYLE_FILE"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo "⚙️ Configuration de HttpClient dans app.config.ts..."
|
|
63
|
+
|
|
64
|
+
CONFIG_FILE="src/app/app.config.ts"
|
|
65
|
+
|
|
66
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
67
|
+
# Vérifier si provideHttpClient est déjà présent
|
|
68
|
+
if ! grep -q "provideHttpClient" "$CONFIG_FILE"; then
|
|
69
|
+
# Utilisation de Node.js pour injecter proprement provideHttpClient dans app.config.ts
|
|
70
|
+
node -e '
|
|
71
|
+
const fs = require("fs");
|
|
72
|
+
let content = fs.readFileSync("'"$CONFIG_FILE"'", "utf8");
|
|
73
|
+
|
|
74
|
+
// Ajouter l import si absent
|
|
75
|
+
if (!content.includes("provideHttpClient")) {
|
|
76
|
+
content = "import { provideHttpClient } from \"@angular/common/http\";\n" + content;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Ajouter provideHttpClient dans providers
|
|
80
|
+
content = content.replace(/providers:\s*\[/, "providers: [\n provideHttpClient(),");
|
|
81
|
+
|
|
82
|
+
fs.writeFileSync("'"$CONFIG_FILE"'", content, "utf8");
|
|
83
|
+
'
|
|
84
|
+
echo "✅ provideHttpClient ajouté avec succès dans $CONFIG_FILE"
|
|
85
|
+
else
|
|
86
|
+
echo "ℹ️ provideHttpClient est déjà configuré dans $CONFIG_FILE"
|
|
87
|
+
fi
|
|
88
|
+
else
|
|
89
|
+
echo "⚠️ Attention : Fichier $CONFIG_FILE introuvable. Pense à ajouter provideHttpClient manuellement."
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
echo "🎉 Installation et configuration terminées avec succès !"
|