angular-generate 2.2.6 → 2.2.8

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 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
 
@@ -174,7 +176,13 @@ Puis importez les styles dans `style.css` ou `style.scss` :
174
176
  @import url('../node_modules/@ng-select/ng-select/themes/default.theme.css');
175
177
  ```
176
178
  ---
179
+ ## 7️⃣ Installer Moment js
177
180
 
181
+ ```bash
182
+ npm install moment
183
+ ```
184
+
185
+ ---
178
186
  # Configuration de HttpClient
179
187
 
180
188
  AngularGenerate utilise `HttpClient` pour communiquer avec l'API Laravel.
@@ -0,0 +1,96 @@
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
+ # 6. Installer moment
29
+ echo "📦 Installation de moment js"
30
+ npm install moment --force
31
+
32
+ echo "🎨 Configuration des styles..."
33
+
34
+ # Détection du fichier de style (styles.scss ou styles.css)
35
+ STYLE_FILE=""
36
+ if [ -f "src/styles.scss" ]; then
37
+ STYLE_FILE="src/styles.scss"
38
+ elif [ -f "src/styles.css" ]; then
39
+ STYLE_FILE="src/styles.css"
40
+ else
41
+ # Création par défaut si aucun n'existe
42
+ STYLE_FILE="src/styles.scss"
43
+ touch "$STYLE_FILE"
44
+ fi
45
+
46
+ # Ajout des imports CSS/SCSS s'ils n'y sont pas déjà
47
+ IMPORTS="
48
+ /* Importing Bootstrap CSS */
49
+ @import 'bootstrap/dist/css/bootstrap.css';
50
+
51
+ /* Importing Bootstrap Icons */
52
+ @import 'bootstrap-icons/font/bootstrap-icons.css';
53
+
54
+ /* Importing NG-Select styles */
55
+ @import '@ng-select/ng-select/themes/default.theme.css';
56
+ "
57
+
58
+ # Vérification et ajout dans le fichier de style
59
+ if ! grep -q "bootstrap/dist/css/bootstrap.css" "$STYLE_FILE"; then
60
+ echo -e "$IMPORTS" >> "$STYLE_FILE"
61
+ echo "✅ Styles ajoutés à $STYLE_FILE"
62
+ else
63
+ echo "ℹ️ Les styles sont déjà présents dans $STYLE_FILE"
64
+ fi
65
+
66
+ echo "⚙️ Configuration de HttpClient dans app.config.ts..."
67
+
68
+ CONFIG_FILE="src/app/app.config.ts"
69
+
70
+ if [ -f "$CONFIG_FILE" ]; then
71
+ # Vérifier si provideHttpClient est déjà présent
72
+ if ! grep -q "provideHttpClient" "$CONFIG_FILE"; then
73
+ # Utilisation de Node.js pour injecter proprement provideHttpClient dans app.config.ts
74
+ node -e '
75
+ const fs = require("fs");
76
+ let content = fs.readFileSync("'"$CONFIG_FILE"'", "utf8");
77
+
78
+ // Ajouter l import si absent
79
+ if (!content.includes("provideHttpClient")) {
80
+ content = "import { provideHttpClient } from \"@angular/common/http\";\n" + content;
81
+ }
82
+
83
+ // Ajouter provideHttpClient dans providers
84
+ content = content.replace(/providers:\s*\[/, "providers: [\n provideHttpClient(),");
85
+
86
+ fs.writeFileSync("'"$CONFIG_FILE"'", content, "utf8");
87
+ '
88
+ echo "✅ provideHttpClient ajouté avec succès dans $CONFIG_FILE"
89
+ else
90
+ echo "ℹ️ provideHttpClient est déjà configuré dans $CONFIG_FILE"
91
+ fi
92
+ else
93
+ echo "⚠️ Attention : Fichier $CONFIG_FILE introuvable. Pense à ajouter provideHttpClient manuellement."
94
+ fi
95
+
96
+ echo "🎉 Installation et configuration terminées avec succès !"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-generate",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "description": "Générateur de composant et code Angular à partir du fichier de configuration config.json",
5
5
  "scripts": {
6
6
  "build": "tsc -p tsconfig.json",