angular-generate 2.2.1
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 +149 -0
- package/explication_conception.md +119 -0
- package/package.json +28 -0
- package/src/api/index.d.ts +2 -0
- package/src/api/index.js +18 -0
- package/src/api/index.js.map +1 -0
- package/src/api/index_spec.d.ts +1 -0
- package/src/api/index_spec.js +23 -0
- package/src/api/index_spec.js.map +1 -0
- package/src/api/schema.json +17 -0
- package/src/collection.json +88 -0
- package/src/component/add/index.d.ts +2 -0
- package/src/component/add/index.js +64 -0
- package/src/component/add/index.js.map +1 -0
- package/src/component/add/index_spec.d.ts +1 -0
- package/src/component/add/index_spec.js +23 -0
- package/src/component/add/index_spec.js.map +1 -0
- package/src/component/deconnexion/index.d.ts +2 -0
- package/src/component/deconnexion/index.js +88 -0
- package/src/component/deconnexion/index.js.map +1 -0
- package/src/component/deconnexion/index_spec.d.ts +1 -0
- package/src/component/deconnexion/index_spec.js +23 -0
- package/src/component/deconnexion/index_spec.js.map +1 -0
- package/src/component/details/index.d.ts +2 -0
- package/src/component/details/index.js +12 -0
- package/src/component/details/index.js.map +1 -0
- package/src/component/details/index_spec.d.ts +1 -0
- package/src/component/details/index_spec.js +23 -0
- package/src/component/details/index_spec.js.map +1 -0
- package/src/component/edit/index.d.ts +2 -0
- package/src/component/edit/index.js +63 -0
- package/src/component/edit/index.js.map +1 -0
- package/src/component/edit/index_spec.d.ts +1 -0
- package/src/component/edit/index_spec.js +23 -0
- package/src/component/edit/index_spec.js.map +1 -0
- package/src/component/header/index.d.ts +2 -0
- package/src/component/header/index.js +311 -0
- package/src/component/header/index.js.map +1 -0
- package/src/component/list/index.d.ts +2 -0
- package/src/component/list/index.js +64 -0
- package/src/component/list/index.js.map +1 -0
- package/src/component/list/index_spec.d.ts +1 -0
- package/src/component/list/index_spec.js +23 -0
- package/src/component/list/index_spec.js.map +1 -0
- package/src/component/login/index.d.ts +2 -0
- package/src/component/login/index.js +314 -0
- package/src/component/login/index.js.map +1 -0
- package/src/component/login/index_spec.d.ts +1 -0
- package/src/component/login/index_spec.js +23 -0
- package/src/component/login/index_spec.js.map +1 -0
- package/src/component/not-found/index.d.ts +2 -0
- package/src/component/not-found/index.js +68 -0
- package/src/component/not-found/index.js.map +1 -0
- package/src/component/not-found/index_spec.d.ts +1 -0
- package/src/component/not-found/index_spec.js +23 -0
- package/src/component/not-found/index_spec.js.map +1 -0
- package/src/component/sidebar/index.d.ts +2 -0
- package/src/component/sidebar/index.js +247 -0
- package/src/component/sidebar/index.js.map +1 -0
- package/src/component/test/index.d.ts +2 -0
- package/src/component/test/index.js +20 -0
- package/src/component/test/index.js.map +1 -0
- package/src/component/test/index_spec.d.ts +1 -0
- package/src/component/test/index_spec.js +23 -0
- package/src/component/test/index_spec.js.map +1 -0
- package/src/component/type/index.d.ts +2 -0
- package/src/component/type/index.js +45 -0
- package/src/component/type/index.js.map +1 -0
- package/src/component/type/index_spec.d.ts +1 -0
- package/src/component/type/index_spec.js +23 -0
- package/src/component/type/index_spec.js.map +1 -0
- package/src/component/wrapper/index.d.ts +2 -0
- package/src/component/wrapper/index.js +175 -0
- package/src/component/wrapper/index.js.map +1 -0
- package/src/component/wrapper/index_spec.d.ts +1 -0
- package/src/component/wrapper/index_spec.js +23 -0
- package/src/component/wrapper/index_spec.js.map +1 -0
- package/src/config/index.d.ts +2 -0
- package/src/config/index.js +166 -0
- package/src/config/index.js.map +1 -0
- package/src/config/index_spec.d.ts +1 -0
- package/src/config/index_spec.js +23 -0
- package/src/config/index_spec.js.map +1 -0
- package/src/config/schema.json +31 -0
- package/src/guard/auth/index.d.ts +2 -0
- package/src/guard/auth/index.js +60 -0
- package/src/guard/auth/index.js.map +1 -0
- package/src/guard/auth/index_spec.d.ts +1 -0
- package/src/guard/auth/index_spec.js +23 -0
- package/src/guard/auth/index_spec.js.map +1 -0
- package/src/guard/permissions/index.d.ts +2 -0
- package/src/guard/permissions/index.js +51 -0
- package/src/guard/permissions/index.js.map +1 -0
- package/src/guard/permissions/index_spec.d.ts +1 -0
- package/src/guard/permissions/index_spec.js +23 -0
- package/src/guard/permissions/index_spec.js.map +1 -0
- package/src/module/index.d.ts +2 -0
- package/src/module/index.js +94 -0
- package/src/module/index.js.map +1 -0
- package/src/module/index_spec.d.ts +1 -0
- package/src/module/index_spec.js +23 -0
- package/src/module/index_spec.js.map +1 -0
- package/src/module/schema.json +17 -0
- package/src/other/taf-add-import-to-module/index.d.ts +2 -0
- package/src/other/taf-add-import-to-module/index.js +20 -0
- package/src/other/taf-add-import-to-module/index.js.map +1 -0
- package/src/other/taf-add-import-to-module/index_spec.d.ts +1 -0
- package/src/other/taf-add-import-to-module/index_spec.js +23 -0
- package/src/other/taf-add-import-to-module/index_spec.js.map +1 -0
- package/src/service/api/index.d.ts +2 -0
- package/src/service/api/index.js +508 -0
- package/src/service/api/index.js.map +1 -0
- package/src/service/api/index_spec.d.ts +1 -0
- package/src/service/api/index_spec.js +23 -0
- package/src/service/api/index_spec.js.map +1 -0
- package/src/templates/add/add.html.d.ts +1 -0
- package/src/templates/add/add.html.js +124 -0
- package/src/templates/add/add.html.js.map +1 -0
- package/src/templates/add/add.ts.d.ts +1 -0
- package/src/templates/add/add.ts.js +112 -0
- package/src/templates/add/add.ts.js.map +1 -0
- package/src/templates/edit/edit.html.d.ts +1 -0
- package/src/templates/edit/edit.html.js +121 -0
- package/src/templates/edit/edit.html.js.map +1 -0
- package/src/templates/edit/edit.ts.d.ts +1 -0
- package/src/templates/edit/edit.ts.js +117 -0
- package/src/templates/edit/edit.ts.js.map +1 -0
- package/src/templates/list/list.html.d.ts +1 -0
- package/src/templates/list/list.html.js +98 -0
- package/src/templates/list/list.html.js.map +1 -0
- package/src/templates/list/list.ts.d.ts +2 -0
- package/src/templates/list/list.ts.js +144 -0
- package/src/templates/list/list.ts.js.map +1 -0
- package/src/templates/test/test.ts.d.ts +4 -0
- package/src/templates/test/test.ts.js +145 -0
- package/src/templates/test/test.ts.js.map +1 -0
- package/tsconfig.json +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# AngularGenerate
|
|
2
|
+
**AngularGenerate** vous permet de générer une application Angular complète en quelques clics.
|
|
3
|
+
**Votre projet** sera composé de:
|
|
4
|
+
- Frontend (Angular) → Généré avec la bibliothèque **AngularGenerate** ( https://www.npmjs.com/package/angular-generate)
|
|
5
|
+
- Backend (LARAVEL) → Généré automatiquement à partir d'une base de données avec **ControllerGenerate** ( https://packagist.org/packages/saloum45/controllergenerate )
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Mise en place du Frontend (Angular) avec AngularGenerate
|
|
9
|
+
### Prérequis
|
|
10
|
+
- Créez un fichier **JSON** dans la racine du projet nommé **config.json** avec le contenu suivant
|
|
11
|
+
- Vous pouvez copier le contenu complet adapté à votre projet directement depuis votre **Backend (PHP) généré par ControllerGenerate**
|
|
12
|
+
```
|
|
13
|
+
{
|
|
14
|
+
"projectName": "projet1.angular",// nom de votre projet angular
|
|
15
|
+
"decription": "Fichier de configuration de config",
|
|
16
|
+
"config_base_url": "http://localhost/8000",// emplacement de ControllerGenerate (plus d'informations https://packagist.org/packages/saloum45/controllergenerate)
|
|
17
|
+
"les_modules": [// tous les modules à générer
|
|
18
|
+
{
|
|
19
|
+
"module": "home",
|
|
20
|
+
"les_tables": [
|
|
21
|
+
// ici les configuration des tables à générer pour le module home
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"module": "public",
|
|
26
|
+
"les_tables": [
|
|
27
|
+
// ici les configuration des tables à générer pour le module public
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
- Installer la présente bibliothèque **angular-generate**
|
|
34
|
+
```
|
|
35
|
+
npm install angular-generate
|
|
36
|
+
```
|
|
37
|
+
- Installer la bibliothèque **@auth0/angular-jwt**
|
|
38
|
+
```
|
|
39
|
+
npm install @auth0/angular-jwt
|
|
40
|
+
```
|
|
41
|
+
- Installer la ng-select **@ng-select/ng-select**
|
|
42
|
+
Attention à la compatibilté de la version de Angular avec la version de ng-select, par exemple :
|
|
43
|
+
Angular ng-select
|
|
44
|
+
>=20.0.0 <21.0.0 v15.x
|
|
45
|
+
>=19.0.0 <20.0.0 v14.x
|
|
46
|
+
>=18.0.0 <19.0.0 v13.x
|
|
47
|
+
>=17.0.0 <18.0.0 v12.x
|
|
48
|
+
voir documention officielle https://www.npmjs.com/package/@ng-select/ng-select
|
|
49
|
+
```
|
|
50
|
+
npm install @ng-select/ng-select
|
|
51
|
+
```
|
|
52
|
+
Importez NG-Select styles avec l'aide du fichier **style.css** ou **style.scss**
|
|
53
|
+
```
|
|
54
|
+
// Importing NG-Select styles
|
|
55
|
+
@import url(../node_modules/@ng-select/ng-select/themes/default.theme.css);
|
|
56
|
+
```
|
|
57
|
+
- Installer la bibliothèque **SweetAlert2** pour les notifications
|
|
58
|
+
```
|
|
59
|
+
npm install sweetalert2
|
|
60
|
+
```
|
|
61
|
+
- Installer la bibliothèque **ng-bootstrap** (https://ng-bootstrap.github.io)
|
|
62
|
+
```
|
|
63
|
+
ng add @ng-bootstrap/ng-bootstrap
|
|
64
|
+
```
|
|
65
|
+
- Installer la bibliothèque **bootstrap && bootstrap-icons**
|
|
66
|
+
```
|
|
67
|
+
npm install bootstrap bootstrap-icons
|
|
68
|
+
```
|
|
69
|
+
- Importez bootstrap (CSS && JS) avec l'aide du fichier **style.css** ou **style.scss**
|
|
70
|
+
```
|
|
71
|
+
/* Importing Bootstrap CSS file. */
|
|
72
|
+
@import 'bootstrap/dist/css/bootstrap.css';
|
|
73
|
+
// Importing bootstrap icons
|
|
74
|
+
@import 'bootstrap-icons/font/bootstrap-icons.css';
|
|
75
|
+
// Importing NG-Select styles
|
|
76
|
+
@import url(../node_modules/@ng-select/ng-select/themes/default.theme.css);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- Configurer le **HttpClient** dans le module principal **app.config.ts**
|
|
80
|
+
```
|
|
81
|
+
.......................................................
|
|
82
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
83
|
+
import { provideRouter, withHashLocation } from '@angular/router';
|
|
84
|
+
|
|
85
|
+
export const appConfig: ApplicationConfig = {
|
|
86
|
+
providers: [provideRouter(routes, withHashLocation()), provideClientHydration(),provideHttpClient()]
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Générer complètement l'application
|
|
91
|
+
```
|
|
92
|
+
ng generate angular-generate:config
|
|
93
|
+
```
|
|
94
|
+
### générer un module
|
|
95
|
+
Supposons que nous voulons générer le module **public** avec tous ses composants, nous lançons la commande suivante
|
|
96
|
+
```
|
|
97
|
+
ng generate angular-generate:config --module public
|
|
98
|
+
```
|
|
99
|
+
### générer les composants d'une seule table
|
|
100
|
+
Supposons que nous voulons générer tous les composants de la table agent, nous lançons la commande suivante
|
|
101
|
+
```
|
|
102
|
+
ng generate angular-generate:config --table agent
|
|
103
|
+
```
|
|
104
|
+
### générer un composant d'une table
|
|
105
|
+
Supposons que nous voulons générer le composant qui liste tous les enregistrements de la table agent, nous lançons la commande suivante
|
|
106
|
+
```
|
|
107
|
+
ng generate angular-generate:config --table agent --type list
|
|
108
|
+
```
|
|
109
|
+
### NB: Les types de composant disponibles
|
|
110
|
+
- **list** : liste tous les enregistrements de la table
|
|
111
|
+
- **add** : formulaire d'ajout de la table
|
|
112
|
+
- **edit** : formulaire de modification de la table
|
|
113
|
+
- **details** : affiche les details d'un enregistrement de la table
|
|
114
|
+
- **login** : formulaire de connexion
|
|
115
|
+
- **deconnexion** : page de déconnexion à l'application
|
|
116
|
+
- **not-found** : si la page demandée est introuvable
|
|
117
|
+
|
|
118
|
+
### Exemple de configuration de app.route.ts
|
|
119
|
+
```
|
|
120
|
+
import { Routes } from '@angular/router';
|
|
121
|
+
import { HomeComponent } from './home/home/home.component';
|
|
122
|
+
import { AuthGuard } from './guard/auth/auth.guard';
|
|
123
|
+
import { PublicComponent } from './public/public/public.component';
|
|
124
|
+
|
|
125
|
+
export const routes: Routes = [
|
|
126
|
+
{ path: "", pathMatch: "full", redirectTo: "public" },
|
|
127
|
+
{
|
|
128
|
+
path: "home",
|
|
129
|
+
component: HomeComponent,
|
|
130
|
+
children: [
|
|
131
|
+
{
|
|
132
|
+
path: "",
|
|
133
|
+
loadChildren: () => import("./home/home.module").then((m) => m.HomeModule)
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
canActivate: [AuthGuard]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
path: "public",
|
|
140
|
+
component: PublicComponent,
|
|
141
|
+
children: [
|
|
142
|
+
{
|
|
143
|
+
path: "",
|
|
144
|
+
loadChildren: () => import("./public/public.module").then((m) => m.PublicModule)
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Voici les commandes pratiques pour exécuter, tester et publier ton projet **Schematics** angular-generate compatible avec Angular 18.
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
## Creer un nouveau chéma
|
|
5
|
+
Pour créer un nouveau schéma, utilise la commande suivante :
|
|
6
|
+
```bash
|
|
7
|
+
schematics blank --name=component/test
|
|
8
|
+
```
|
|
9
|
+
## **1. Installation des dépendances**
|
|
10
|
+
Avant toute chose, assure-toi d’installer les dépendances requises :
|
|
11
|
+
```bash
|
|
12
|
+
npm install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## **2. Compiler le projet**
|
|
18
|
+
Avant de tester ton Schematics, compile-le avec :
|
|
19
|
+
```bash
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
Cela génère les fichiers JavaScript nécessaires.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## **3. Tester le Schematics en local**
|
|
27
|
+
Pour tester la génération d’un composant sans publier, utilise :
|
|
28
|
+
```bash
|
|
29
|
+
schematics .:component --name=test-component
|
|
30
|
+
```
|
|
31
|
+
Si tu veux tester avec un projet Angular spécifique :
|
|
32
|
+
```bash
|
|
33
|
+
cd ../mon-projet-angular
|
|
34
|
+
ng add ../chemin-vers-ton-schematics
|
|
35
|
+
ng generate angular-generate:component test-component
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## **4. Lien symbolique pour tester en mode développement**
|
|
41
|
+
Au lieu de re-publier à chaque test, utilise un **lien symbolique** :
|
|
42
|
+
1. **Dans ton projet Schematics angular-generate**, exécute :
|
|
43
|
+
```bash
|
|
44
|
+
npm link
|
|
45
|
+
```
|
|
46
|
+
2. **Dans un projet Angular où tu veux tester**, exécute :
|
|
47
|
+
```bash
|
|
48
|
+
npm link angular-generate
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Tu peux maintenant exécuter :
|
|
52
|
+
```bash
|
|
53
|
+
ng g angular-generate:component test-component
|
|
54
|
+
```
|
|
55
|
+
Et voir si le composant est bien généré.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## **5. Publier ton Schematics sur NPM**
|
|
60
|
+
Une fois les tests validés, publie-le sur NPM :
|
|
61
|
+
1. **Assure-toi d’être connecté à ton compte NPM** :
|
|
62
|
+
```bash
|
|
63
|
+
npm login
|
|
64
|
+
```
|
|
65
|
+
2. **Incrémente la version (`package.json`)** :
|
|
66
|
+
```bash
|
|
67
|
+
npm version patch
|
|
68
|
+
```
|
|
69
|
+
ou
|
|
70
|
+
```bash
|
|
71
|
+
npm version minor
|
|
72
|
+
```
|
|
73
|
+
ou
|
|
74
|
+
```bash
|
|
75
|
+
npm version major
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. **Publie le package sur NPM** :
|
|
79
|
+
```bash
|
|
80
|
+
npm publish --access public
|
|
81
|
+
```
|
|
82
|
+
⚠️ Si ton package est privé, retire `--access public`.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## **6. Installer ton Schematics dans un projet Angular**
|
|
87
|
+
Si ton Schematics est sur **NPM**, tu peux l’installer dans n’importe quel projet Angular avec :
|
|
88
|
+
```bash
|
|
89
|
+
ng add angular-generate
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Puis, pour générer un composant :
|
|
93
|
+
```bash
|
|
94
|
+
ng g angular-generate:component mon-nouveau-composant
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## **7. Mettre à jour un projet qui utilise angular-generate**
|
|
100
|
+
Si tu as publié une nouvelle version et veux la mettre à jour :
|
|
101
|
+
```bash
|
|
102
|
+
npm update angular-generate
|
|
103
|
+
```
|
|
104
|
+
ou
|
|
105
|
+
```bash
|
|
106
|
+
ng update angular-generate
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## **8. Vérifier et lister les commandes disponibles**
|
|
112
|
+
Si tu veux voir toutes les commandes disponibles pour ton Schematics :
|
|
113
|
+
```bash
|
|
114
|
+
schematics . --list-schematics
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
Avec ces commandes, tu peux **compiler, tester, lier en local, publier et utiliser** ton Schematics Angular 18 dans n'importe quel projet. 🚀
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "angular-generate",
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "Générateur de composant et code Angular à partir du fichier de configuration config.json",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc -p tsconfig.json",
|
|
7
|
+
"test": "npm run build && jasmine src/**/*_spec.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"schematics"
|
|
11
|
+
],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"schematics": "./src/collection.json",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@angular-devkit/core": "^18.0.0",
|
|
17
|
+
"@angular-devkit/schematics": "^18.0.0",
|
|
18
|
+
"@angular-devkit/schematics-cli": "^18.0.0",
|
|
19
|
+
"@schematics/angular": "^18.0.0",
|
|
20
|
+
"typescript": "~5.2.0"
|
|
21
|
+
}
|
|
22
|
+
,
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/jasmine": "~4.3.0",
|
|
25
|
+
"@types/node": "^14.15.0",
|
|
26
|
+
"jasmine": "^4.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/api/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.api = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
6
|
+
// per file.
|
|
7
|
+
function api(options) {
|
|
8
|
+
const Config = options.Config;
|
|
9
|
+
const projectName = options.projectName;
|
|
10
|
+
const parent = options.parent;
|
|
11
|
+
const table = options.table;
|
|
12
|
+
//console.log("les_types= ",table)
|
|
13
|
+
return (0, schematics_1.chain)([
|
|
14
|
+
...table.les_types.map((un_type) => { return (0, schematics_1.schematic)(un_type, { projectName: projectName, parent: parent + "/", table: table, Config: Config }); }),
|
|
15
|
+
]);
|
|
16
|
+
}
|
|
17
|
+
exports.api = api;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2DAAoE;AAGpE,iGAAiG;AACjG,YAAY;AACZ,SAAgB,GAAG,CAAC,OAAY;IAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC7B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;IACvC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;IAC3B,kCAAkC;IAElC,OAAO,IAAA,kBAAK,EAAC;QACX,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAe,EAAE,EAAE,GAAG,OAAO,IAAA,sBAAS,EAAC,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;KAC7J,CAAC,CAAA;AACJ,CAAC;AAVD,kBAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
+
describe('api', () => {
|
|
17
|
+
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
+
const tree = yield runner.runSchematic('api', {}, schematics_1.Tree.empty());
|
|
20
|
+
expect(tree.files).toEqual([]);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index_spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACnB,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEhE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"properties": {
|
|
3
|
+
"projectName": {
|
|
4
|
+
"type": "string",
|
|
5
|
+
"x-prompt": "Quel est le nom de votre projet Angular ?"
|
|
6
|
+
},
|
|
7
|
+
"parent": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"x-prompt": "Ou est ce que tu souhaite loger les fichiers à générer ('home' => si dans un dossier 'home') ?"
|
|
10
|
+
},
|
|
11
|
+
"table": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"x-prompt": "Quel est le nom de la table ?"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"config": {
|
|
5
|
+
"description": "A blank schematic.",
|
|
6
|
+
"factory": "./config/index#config",
|
|
7
|
+
"schema": "./config/schema.json"
|
|
8
|
+
},
|
|
9
|
+
"api": {
|
|
10
|
+
"description": "A blank schematic.",
|
|
11
|
+
"factory": "./api/index#api",
|
|
12
|
+
"schema": "./api/schema.json"
|
|
13
|
+
},
|
|
14
|
+
"add": {
|
|
15
|
+
"description": "A blank schematic.",
|
|
16
|
+
"factory": "./component/add/index#add"
|
|
17
|
+
},
|
|
18
|
+
"edit": {
|
|
19
|
+
"description": "A blank schematic.",
|
|
20
|
+
"factory": "./component/edit/index#edit"
|
|
21
|
+
},
|
|
22
|
+
"list": {
|
|
23
|
+
"description": "A blank schematic.",
|
|
24
|
+
"factory": "./component/list/index#list"
|
|
25
|
+
},
|
|
26
|
+
"module": {
|
|
27
|
+
"description": "A blank schematic.",
|
|
28
|
+
"factory": "./module/index#module",
|
|
29
|
+
"schema": "./module/schema.json"
|
|
30
|
+
},
|
|
31
|
+
"config-add-import-to-module": {
|
|
32
|
+
"description": "A blank schematic.",
|
|
33
|
+
"factory": "./other/config-add-import-to-module/index#configAddImportToModule"
|
|
34
|
+
},
|
|
35
|
+
"wrapper": {
|
|
36
|
+
"description": "A blank schematic.",
|
|
37
|
+
"factory": "./component/wrapper/index#wrapper"
|
|
38
|
+
},
|
|
39
|
+
"details": {
|
|
40
|
+
"description": "A blank schematic.",
|
|
41
|
+
"factory": "./component/details/index#details"
|
|
42
|
+
},
|
|
43
|
+
"login": {
|
|
44
|
+
"description": "A blank schematic.",
|
|
45
|
+
"factory": "./component/login/index#login"
|
|
46
|
+
},
|
|
47
|
+
"service/api": {
|
|
48
|
+
"description": "A blank schematic.",
|
|
49
|
+
"factory": "./service/api/index#api"
|
|
50
|
+
},
|
|
51
|
+
"guard/auth": {
|
|
52
|
+
"description": "A blank schematic.",
|
|
53
|
+
"factory": "./guard/auth/index#auth"
|
|
54
|
+
},
|
|
55
|
+
"guard/permissions": {
|
|
56
|
+
"description": "A blank schematic.",
|
|
57
|
+
"factory": "./guard/permissions/index#permissions"
|
|
58
|
+
},
|
|
59
|
+
"not-found": {
|
|
60
|
+
"description": "A blank schematic.",
|
|
61
|
+
"factory": "./component/not-found/index#notFound"
|
|
62
|
+
},
|
|
63
|
+
"deconnexion": {
|
|
64
|
+
"description": "A blank schematic.",
|
|
65
|
+
"factory": "./component/deconnexion/index#deconnexion"
|
|
66
|
+
},
|
|
67
|
+
"create-component": {
|
|
68
|
+
"description": "A blank schematic.",
|
|
69
|
+
"factory": "./create-component/index#createComponent"
|
|
70
|
+
},
|
|
71
|
+
"type": {
|
|
72
|
+
"description": "Type de la table",
|
|
73
|
+
"factory": "./component/type/index#type"
|
|
74
|
+
},
|
|
75
|
+
"test": {
|
|
76
|
+
"description": "A blank schematic.",
|
|
77
|
+
"factory": "./component/test/index#test"
|
|
78
|
+
},
|
|
79
|
+
"sidebar": {
|
|
80
|
+
"description": "Crée le composant Sidebar.",
|
|
81
|
+
"factory": "./component/sidebar/index#sidebar"
|
|
82
|
+
},
|
|
83
|
+
"header": {
|
|
84
|
+
"description": "Crée le composant Header.",
|
|
85
|
+
"factory": "./component/header/index#header"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.add = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
6
|
+
const add_ts_1 = require("../../templates/add/add.ts");
|
|
7
|
+
const add_html_1 = require("../../templates/add/add.html");
|
|
8
|
+
const test_ts_js_1 = require("../../templates/test/test.ts.js");
|
|
9
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
10
|
+
// per file.
|
|
11
|
+
function add(options) {
|
|
12
|
+
const { table, projectName, parent, Config } = options;
|
|
13
|
+
// console.log("add table = ", options)
|
|
14
|
+
const componentType = "add";
|
|
15
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"ListLivre"
|
|
16
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
17
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // home/auteur/list-auteur
|
|
18
|
+
return (tree) => {
|
|
19
|
+
// Le composant existe dèja
|
|
20
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
21
|
+
if (tree.exists(c_path)) {
|
|
22
|
+
console.warn(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
23
|
+
if (Config.forcer) {
|
|
24
|
+
console.warn("Forcer la Mise à jour du composant ...");
|
|
25
|
+
return (0, schematics_1.chain)([
|
|
26
|
+
// modification des fichiers
|
|
27
|
+
(tree, _context) => {
|
|
28
|
+
// modifier le fichier HTML
|
|
29
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
30
|
+
(0, add_html_1.get_html_content)(table));
|
|
31
|
+
// modifier le fichier TS
|
|
32
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
33
|
+
(0, add_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
34
|
+
// modifier le fichier TS de test
|
|
35
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
36
|
+
(0, test_ts_js_1.get_ts_test_add_content)(componentName_class));
|
|
37
|
+
}
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return tree;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// le composant n'existe pas encore
|
|
45
|
+
return (0, schematics_1.chain)([
|
|
46
|
+
// création du composant
|
|
47
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
48
|
+
// modification des fichiers
|
|
49
|
+
(tree, _context) => {
|
|
50
|
+
// modifier le fichier HTML
|
|
51
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
52
|
+
(0, add_html_1.get_html_content)(table));
|
|
53
|
+
// modifier le fichier TS
|
|
54
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
55
|
+
(0, add_ts_1.get_ts_content)(table, componentName_class, componentName, Config));
|
|
56
|
+
// modifier le fichier TS de test
|
|
57
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.spec.ts`, // home/auteur/lis-auteur/list-auteur.component.spec.ts
|
|
58
|
+
(0, test_ts_js_1.get_ts_test_add_content)(componentName_class));
|
|
59
|
+
}
|
|
60
|
+
]);
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exports.add = add;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
+
const path = require("path");
|
|
15
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
|
16
|
+
describe('add', () => {
|
|
17
|
+
it('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
19
|
+
const tree = yield runner.runSchematic('add', {}, schematics_1.Tree.empty());
|
|
20
|
+
expect(tree.files).toEqual([]);
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index_spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkD;AAClD,gEAAyE;AACzE,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACnB,EAAE,CAAC,OAAO,EAAE,GAAS,EAAE;QACrB,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,iBAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAEhE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deconnexion = void 0;
|
|
4
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
// You don't have to export the function as default. You can also have more than one rule factory
|
|
7
|
+
// per file.
|
|
8
|
+
function deconnexion(_options) {
|
|
9
|
+
const { table, projectName, parent, Config } = _options;
|
|
10
|
+
//console.log("table = ", table)
|
|
11
|
+
const componentType = "list";
|
|
12
|
+
const componentName_class = (0, strings_1.classify)(componentType) + (0, strings_1.classify)(table.table); //"Login"
|
|
13
|
+
const componentName = (0, strings_1.dasherize)(componentName_class);
|
|
14
|
+
const fullComponentName = parent + (0, strings_1.dasherize)(table.table) + "/" + componentName; // home/auteur/list-auteur
|
|
15
|
+
return (tree) => {
|
|
16
|
+
// Le composant existe dèja
|
|
17
|
+
let c_path = `/src/app/${fullComponentName}/${componentName}.component.ts`;
|
|
18
|
+
if (tree.exists(c_path)) {
|
|
19
|
+
console.log(`Le composant ${componentName} existe dèja dans le module ${parent} : ${c_path}`);
|
|
20
|
+
return tree;
|
|
21
|
+
}
|
|
22
|
+
// le composant n'existe pas encore
|
|
23
|
+
return (0, schematics_1.chain)([
|
|
24
|
+
// création du composant
|
|
25
|
+
(0, schematics_1.externalSchematic)("@schematics/angular", "component", { project: projectName, name: fullComponentName, style: Config.style, standalone: true }),
|
|
26
|
+
// modification des fichiers
|
|
27
|
+
(tree, _context) => {
|
|
28
|
+
// modifier le fichier HTML
|
|
29
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.html`, // home/auteur/lis-auteur/list-auteur.component.html
|
|
30
|
+
get_html_content()),
|
|
31
|
+
// modifier le fichier TS
|
|
32
|
+
tree.overwrite(`src/app/${fullComponentName}/${componentName}.component.ts`, // home/auteur/lis-auteur/list-auteur.component.ts
|
|
33
|
+
get_ts_content(componentName, componentName_class, Config));
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.deconnexion = deconnexion;
|
|
39
|
+
function get_html_content() {
|
|
40
|
+
return `<div class="d-flex align-items-center text-center vh-100">
|
|
41
|
+
<div class="container">
|
|
42
|
+
<h1>Voulez-vous vraiment vous déconnecter ?</h1>
|
|
43
|
+
<button class="btn btn-danger mx-2" (click)="deconnexion()">Oui</button>
|
|
44
|
+
<button class="btn btn-outline-secondary mx-2" (click)="backClicked()">Retourner à la page pécédente</button>
|
|
45
|
+
<br>
|
|
46
|
+
<br>
|
|
47
|
+
<a [routerLink]="['/']">Retourner à la page d'accueil</a>
|
|
48
|
+
</div>
|
|
49
|
+
</div>`;
|
|
50
|
+
}
|
|
51
|
+
function get_ts_content(componentName, componentName_class, Config) {
|
|
52
|
+
return `import { Component } from '@angular/core';
|
|
53
|
+
import { Location } from '@angular/common';
|
|
54
|
+
import { ApiService } from 'src/app/service/api/api.service';
|
|
55
|
+
import { Router } from '@angular/router';
|
|
56
|
+
|
|
57
|
+
@Component({
|
|
58
|
+
selector: 'app-${componentName}',
|
|
59
|
+
standalone: true, // Composant autonome
|
|
60
|
+
imports: [],
|
|
61
|
+
templateUrl: './${componentName}.component.html',
|
|
62
|
+
styleUrls: ['./${componentName}.component.${Config.style}']
|
|
63
|
+
})
|
|
64
|
+
export class ${componentName_class}Component {
|
|
65
|
+
constructor(private _location: Location,public api:ApiService,private route:Router) { }
|
|
66
|
+
|
|
67
|
+
backClicked() {
|
|
68
|
+
this._location.back();
|
|
69
|
+
}
|
|
70
|
+
async deconnexion() {
|
|
71
|
+
await this.api.delete_from_local_storage("token")
|
|
72
|
+
this.api.network = {
|
|
73
|
+
token: undefined,
|
|
74
|
+
status: true,
|
|
75
|
+
message: "Aucun probléme détecté",
|
|
76
|
+
}
|
|
77
|
+
this.api.token = {
|
|
78
|
+
token_key: null,
|
|
79
|
+
token_decoded: null,
|
|
80
|
+
user_connected: null,
|
|
81
|
+
is_expired: null,
|
|
82
|
+
date_expiration: null
|
|
83
|
+
}
|
|
84
|
+
this.route.navigate(['/'])
|
|
85
|
+
}
|
|
86
|
+
}`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=index.js.map
|