@ridiormf/version-control 1.1.0 → 1.1.3

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.fr.md ADDED
@@ -0,0 +1,396 @@
1
+ # Version Control
2
+
3
+ [![en](https://img.shields.io/badge/lang-en-blue.svg)](README.md)
4
+ [![pt](https://img.shields.io/badge/lang-pt-green.svg)](README.pt.md)
5
+ [![es](https://img.shields.io/badge/lang-es-yellow.svg)](README.es.md)
6
+ [![fr](https://img.shields.io/badge/lang-fr-purple.svg)](README.fr.md)
7
+
8
+ > Système intelligent de contrôle de version qui analyse les commits Git et automatise le versionnage sémantique (SemVer).
9
+
10
+ [![npm version](https://img.shields.io/npm/v/@ridio/version-control.svg)](https://www.npmjs.com/package/@ridio/version-control)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
+
13
+ ## 📋 Table des Matières
14
+
15
+ - [À propos](#à-propos)
16
+ - [Installation](#installation)
17
+ - [Utilisation](#utilisation)
18
+ - [Comment ça marche](#comment-ça-marche)
19
+ - [Exemples](#exemples)
20
+ - [API](#api)
21
+ - [Contribuer](#contribuer)
22
+ - [Licence](#licence)
23
+
24
+ ## 🎯 À propos
25
+
26
+ **Version Control** automatise le versionnage sémantique de votre projet, éliminant le besoin de décider manuellement entre MAJOR, MINOR ou PATCH.
27
+
28
+ **Pourquoi a-t-il été créé ?**
29
+
30
+ Le versionnage manuel est sujet aux erreurs et incohérent entre les équipes. Cet outil résout :
31
+
32
+ - ❌ Oubli de mise à jour de \`package.json\`, \`CHANGELOG.md\` ou des tags
33
+ - ❌ Confusion sur la version à utiliser (MAJOR/MINOR/PATCH)
34
+ - ❌ CHANGELOGs incomplets ou désorganisés
35
+ - ❌ Messages de commit incohérents
36
+
37
+ **Solution :**
38
+
39
+ - ✅ Analyse automatiquement les commits et suggère la version correcte
40
+ - ✅ Met à jour tous les fichiers en une fois
41
+ - ✅ Génère des CHANGELOGs organisés et complets
42
+ - ✅ Crée des tags et pousse automatiquement
43
+
44
+ ### ✨ Fonctionnalités
45
+
46
+ - 🔍 **Analyse Intelligente** : Analyse les messages de commit et les fichiers modifiés
47
+ - 🎯 **Suggestion Automatique** : Suggère MAJOR, MINOR ou PATCH selon les changements
48
+ - 📝 **Mise à Jour Automatique** : Met à jour \`package.json\`, \`CHANGELOG.md\` et les fichiers de code
49
+ - 🏷️ **Git Tags** : Crée automatiquement des tags et pousse vers le dépôt
50
+ - 🤖 **Smart Commit** : Génère des messages de commit suivant Conventional Commits
51
+ - 📋 **CHANGELOG Intelligent** : Groupe les commits par type et supprime les doublons
52
+ - 🧪 **Mode Test** : Permet le rollback automatique
53
+ - 🌍 **Internationalisation** : Support pour EN, PT, ES, FR
54
+
55
+ ## 📦 Installation
56
+
57
+ ### Global (Recommandé)
58
+
59
+ \`\`\`bash
60
+ yarn global add @ridiormf/version-control
61
+ # ou
62
+ npm install -g @ridiormf/version-control
63
+ \`\`\`
64
+
65
+ ### Comme dépendance de développement
66
+
67
+ \`\`\`bash
68
+ yarn add -D @ridiormf/version-control
69
+ # ou
70
+ npm install -D @ridiormf/version-control
71
+ \`\`\`
72
+
73
+ ### Utiliser npx (sans installation)
74
+
75
+ \`\`\`bash
76
+ npx @ridiormf/version-control
77
+ # ou
78
+ yarn dlx @ridiormf/version-control
79
+ \`\`\`
80
+
81
+ ## 🚀 Utilisation
82
+
83
+ ### CLI - Contrôle de Version
84
+
85
+ Après avoir fait vos modifications et committé :
86
+
87
+ \`\`\`bash
88
+ version-control
89
+ \`\`\`
90
+
91
+ Ou avec npx (sans installer) :
92
+
93
+ \`\`\`bash
94
+ npx @ridiormf/version-control
95
+ \`\`\`
96
+
97
+ ### CLI - Smart Commit
98
+
99
+ Commit intelligent avec message automatique :
100
+
101
+ \`\`\`bash
102
+ git add .
103
+ smart-commit
104
+ \`\`\`
105
+
106
+ **Exemple :**
107
+
108
+ \`\`\`bash
109
+ Fichiers staged : 2
110
+ ✨ src/newFeature.ts (+45/-0)
111
+ 📝 src/index.ts (+5/-2)
112
+
113
+ Message de commit généré :
114
+ feat(src): add newFeature
115
+
116
+ Options : [1] Commit [2] Éditer [3] Annuler
117
+ Choix : 1
118
+
119
+ ✓ Commit créé avec succès !
120
+ \`\`\`
121
+
122
+ ### Ajouter à package.json
123
+
124
+ Ajoutez un script à votre \`package.json\` :
125
+
126
+ \`\`\`json
127
+ {
128
+ "scripts": {
129
+ "version": "version-control",
130
+ "version:test": "version-control --test",
131
+ "commit": "smart-commit"
132
+ }
133
+ }
134
+ \`\`\`
135
+
136
+ Et exécutez :
137
+
138
+ \`\`\`bash
139
+ # Smart commit
140
+ yarn commit
141
+
142
+ # Versionnage normal
143
+ yarn version
144
+
145
+ # Versionnage de test (permet le rollback)
146
+ yarn version:test
147
+ \`\`\`
148
+
149
+ ### Utilisation Programmatique
150
+
151
+ Utilisez la bibliothèque dans vos scripts personnalisés :
152
+
153
+ \`\`\`typescript
154
+ import {
155
+ analyzeChanges,
156
+ bumpVersion,
157
+ getCurrentVersion,
158
+ updatePackageJson,
159
+ updateChangelog,
160
+ executeGitCommands,
161
+ } from "@ridiormf/version-control";
162
+
163
+ // 1. Obtenir la version actuelle
164
+ const currentVersion = getCurrentVersion();
165
+ // Retourne : "1.2.3"
166
+
167
+ // 2. Analyser les changements du dernier commit
168
+ const analysis = analyzeChanges();
169
+ // Retourne : { type: 'minor', reason: ['Nouvelle fonctionnalité ajoutée'], filesChanged: [...], commitMsg: '...' }
170
+
171
+ // 3. Calculer la nouvelle version
172
+ const newVersion = bumpVersion(currentVersion, analysis.type);
173
+ // Retourne : "1.3.0"
174
+
175
+ // 4. Mettre à jour les fichiers
176
+ updatePackageJson(newVersion);
177
+ updateChangelog(newVersion, analysis.type, analysis);
178
+
179
+ // 5. Commit et créer le tag
180
+ executeGitCommands(newVersion);
181
+ \`\`\`
182
+
183
+ ## 🔧 Comment ça marche
184
+
185
+ Le système analyse les changements depuis le dernier commit Git et suggère la version appropriée basée sur le format Conventional Commits et les changements de fichiers.
186
+
187
+ ### 🔴 MAJOR (X.0.0) - Changements Incompatibles
188
+
189
+ Détecté quand le message de commit contient des mots-clés comme :
190
+
191
+ - \`breaking\`, \`break\`, \`incompatible\`, \`remove\`, \`delete\`, \`rewrite\`
192
+
193
+ **Exemple :**
194
+
195
+ \`\`\`bash
196
+ git commit -m "breaking: remove deprecated API methods"
197
+ # Suggère : 1.5.3 → 2.0.0
198
+ \`\`\`
199
+
200
+ ### 🟡 MINOR (x.Y.0) - Nouvelles Fonctionnalités
201
+
202
+ Détecté quand :
203
+
204
+ - Le message contient : \`add\`, \`new\`, \`feature\`, \`implement\`, \`create\`
205
+ - De nouveaux fichiers sont ajoutés au projet
206
+ - Les fichiers de configuration sont modifiés
207
+
208
+ **Exemple :**
209
+
210
+ \`\`\`bash
211
+ git commit -m "feat: add user authentication module"
212
+ # Suggère : 1.5.3 → 1.6.0
213
+ \`\`\`
214
+
215
+ ### 🟢 PATCH (x.y.Z) - Corrections
216
+
217
+ Détecté quand le message contient :
218
+
219
+ - \`fix\`, \`bug\`, \`error\`
220
+ - Petits changements sans nouveaux fichiers
221
+
222
+ **Exemple :**
223
+
224
+ \`\`\`bash
225
+ git commit -m "fix: resolve memory leak in cache"
226
+ # Suggère : 1.5.3 → 1.5.4
227
+ \`\`\`
228
+
229
+ ### 📊 Versionnage Sémantique
230
+
231
+ \`\`\`
232
+ Casse le code existant ?
233
+ ├─ OUI → 🔴 MAJOR (X.0.0)
234
+ └─ NON → Ajoute des fonctionnalités ?
235
+ ├─ OUI → 🟡 MINOR (x.Y.0)
236
+ └─ NON → 🟢 PATCH (x.y.Z)
237
+ \`\`\`
238
+
239
+ Voir plus sur [semver.org](https://semver.org/)
240
+
241
+ ## 📖 Exemples
242
+
243
+ ### Flux Typique
244
+
245
+ \`\`\`bash
246
+ git commit -m "feat: add new export functionality"
247
+ version-control
248
+
249
+ # Version actuelle : 1.2.3
250
+ # Type suggéré : MINOR
251
+ # Nouvelle version : 1.3.0
252
+ #
253
+ # Mettre à jour la version ? (y/n) : y
254
+ #
255
+ # ✓ package.json mis à jour
256
+ # ✓ CHANGELOG.md mis à jour
257
+ # ✓ Tag v1.3.0 créé
258
+ # ✓ Version 1.3.0 publiée !
259
+ \`\`\`
260
+
261
+ ## 📚 API
262
+
263
+ ### Méthodes Disponibles
264
+
265
+ #### Analyse et Versionnage
266
+
267
+ - \`analyzeChanges()\` - Analyse le dernier commit et suggère le type de version
268
+ - \`getCurrentVersion(projectRoot?)\` - Retourne la version actuelle depuis package.json
269
+ - \`bumpVersion(currentVersion, type)\` - Calcule la nouvelle version
270
+
271
+ #### Mise à Jour des Fichiers
272
+
273
+ - \`updatePackageJson(newVersion, projectRoot?)\` - Met à jour package.json
274
+ - \`updateIndexFile(newVersion, projectRoot?)\` - Met à jour @version dans les fichiers de code
275
+ - \`updateChangelog(version, type, analysis, projectRoot?)\` - Met à jour CHANGELOG.md
276
+
277
+ #### Commit et Git
278
+
279
+ - \`executeGitCommands(version)\` - Crée commit, tag et pousse
280
+ - \`getStagedChanges()\` - Liste les fichiers staged
281
+ - \`generateCommitMessage(changes)\` - Génère un message de commit automatique
282
+
283
+ #### Configuration
284
+
285
+ - \`getConfiguredLanguage()\` - Retourne la langue configurée
286
+ - \`setLanguage(lang)\` - Définit la langue manuellement
287
+ - \`clearConfig()\` - Supprime la configuration
288
+
289
+ ---
290
+
291
+ ### Détails
292
+
293
+ #### \`analyzeChanges(): ChangeAnalysis\`
294
+
295
+ Analyse le dernier commit et retourne une analyse des changements.
296
+
297
+ **Retourne :**
298
+
299
+ \`\`\`typescript
300
+ interface ChangeAnalysis {
301
+ type: "major" | "minor" | "patch";
302
+ reason: string[];
303
+ filesChanged: string[];
304
+ commitMsg: string;
305
+ }
306
+ \`\`\`
307
+
308
+ #### \`getCurrentVersion(projectRoot?: string): string\`
309
+
310
+ Retourne la version actuelle depuis \`package.json\`.
311
+
312
+ **Paramètres :**
313
+
314
+ - \`projectRoot\` (optionnel) : Chemin racine du projet (par défaut : \`process.cwd()\`)
315
+
316
+ #### \`bumpVersion(currentVersion: string, type: VersionType): string\`
317
+
318
+ Calcule la nouvelle version basée sur le type de bump.
319
+
320
+ **Paramètres :**
321
+
322
+ - \`currentVersion\` : Version actuelle (ex., "1.2.3")
323
+ - \`type\` : Type de bump (\`'major'\`, \`'minor'\`, ou \`'patch'\`)
324
+
325
+ **Exemple :**
326
+
327
+ \`\`\`typescript
328
+ bumpVersion("1.2.3", "major"); // "2.0.0"
329
+ bumpVersion("1.2.3", "minor"); // "1.3.0"
330
+ bumpVersion("1.2.3", "patch"); // "1.2.4"
331
+ \`\`\`
332
+
333
+ ## 🌍 Internationalisation
334
+
335
+ L'outil détecte automatiquement la langue du système et ajuste tous les messages en conséquence.
336
+
337
+ ### Langues Supportées
338
+
339
+ - 🇬🇧 **Anglais (EN)** - Par défaut
340
+ - 🇧🇷 **Portugais (PT)** - pt_BR, pt_PT
341
+ - 🇪🇸 **Espagnol (ES)** - es_ES, es_MX, etc.
342
+ - 🇫🇷 **Français (FR)** - fr_FR, fr_CA, etc.
343
+
344
+ ### Configuration Manuelle de la Langue
345
+
346
+ \`\`\`bash
347
+ # Configurer en Portugais
348
+ version-control config --lang pt
349
+
350
+ # Configurer en Anglais
351
+ version-control config --lang en
352
+
353
+ # Configurer en Espagnol
354
+ version-control config --lang es
355
+
356
+ # Configurer en Français
357
+ version-control config --lang fr
358
+
359
+ # Effacer la configuration (retour à la détection automatique)
360
+ version-control config --clear
361
+
362
+ # Voir la configuration actuelle
363
+ version-control config
364
+ \`\`\`
365
+
366
+ La configuration est sauvegardée globalement dans \`~/.version-control-config.json\` et sera utilisée dans tous les projets.
367
+
368
+ ## 🎯 Mots-Clés
369
+
370
+ - **MAJOR** : \`breaking\`, \`remove\`, \`delete\`, \`rewrite\`
371
+ - **MINOR** : \`add\`, \`new\`, \`feature\`, \`implement\`
372
+ - **PATCH** : \`fix\`, \`bug\`, \`error\`
373
+
374
+ ## 🤝 Contribuer
375
+
376
+ Les contributions sont les bienvenues ! N'hésitez pas à :
377
+
378
+ 1. Forker le projet
379
+ 2. Créer une branche pour votre fonctionnalité (\`git checkout -b feature/AmazingFeature\`)
380
+ 3. Committer vos changements (\`git commit -m 'feat: add some AmazingFeature'\`)
381
+ 4. Pousser vers la branche (\`git push origin feature/AmazingFeature\`)
382
+ 5. Ouvrir une Pull Request
383
+
384
+ ## 📄 Licence
385
+
386
+ Ce projet est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de détails.
387
+
388
+ ## 👤 Auteur
389
+
390
+ **Ridio Ricardo**
391
+
392
+ - GitHub : [@ridioricardo](https://github.com/ridioricardo)
393
+
394
+ ---
395
+
396
+ Basé sur les spécifications de [Semantic Versioning 2.0.0](https://semver.org/)