@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.es.md +396 -0
- package/README.fr.md +396 -0
- package/README.md +225 -537
- package/README.pt.md +508 -0
- package/bin/smart-commit.js +79 -35
- package/bin/version-control.js +6 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +2 -1
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -12
- package/dist/index.js.map +1 -1
- package/dist/readline.d.ts +14 -0
- package/dist/readline.d.ts.map +1 -1
- package/dist/readline.js +32 -0
- package/dist/readline.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/updateChecker.d.ts +5 -0
- package/dist/updateChecker.d.ts.map +1 -1
- package/dist/updateChecker.js +18 -2
- package/dist/updateChecker.js.map +1 -1
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,125 +1,129 @@
|
|
|
1
1
|
# Version Control
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](README.md)
|
|
4
|
+
[](README.pt.md)
|
|
5
|
+
[](README.es.md)
|
|
6
|
+
[](README.fr.md)
|
|
7
|
+
|
|
8
|
+
> Intelligent version control system that analyzes Git commits and automates semantic versioning (SemVer).
|
|
4
9
|
|
|
5
10
|
[](https://www.npmjs.com/package/@ridio/version-control)
|
|
6
11
|
[](https://opensource.org/licenses/MIT)
|
|
7
12
|
|
|
8
|
-
## 📋
|
|
13
|
+
## 📋 Table of Contents
|
|
9
14
|
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
+
- [About](#about)
|
|
16
|
+
- [Installation](#installation)
|
|
17
|
+
- [Usage](#usage)
|
|
18
|
+
- [How It Works](#how-it-works)
|
|
19
|
+
- [Examples](#examples)
|
|
15
20
|
- [API](#api)
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
21
|
+
- [Contributing](#contributing)
|
|
22
|
+
- [License](#license)
|
|
23
|
+
|
|
24
|
+
## 🎯 About
|
|
25
|
+
|
|
26
|
+
**Version Control** automates semantic versioning of your project, eliminating the need to manually decide between MAJOR, MINOR, or PATCH.
|
|
27
|
+
|
|
28
|
+
**Why was it created?**
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
Manual versioning is error-prone and inconsistent across teams. This tool solves:
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
- ❌ Forgetting to update \`package.json\`, \`CHANGELOG.md\`, or tags
|
|
33
|
+
- ❌ Confusion about which version to use (MAJOR/MINOR/PATCH)
|
|
34
|
+
- ❌ Incomplete or disorganized CHANGELOGs
|
|
35
|
+
- ❌ Inconsistent commit messages
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
**Solution:**
|
|
24
38
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
- 🎨 **Interface Colorida**: Output colorido e intuitivo no terminal
|
|
30
|
-
- 🔄 **Interativo**: Permite confirmar ou modificar a versão sugerida
|
|
31
|
-
- 🤖 **Smart Commit**: Gera mensagens de commit automaticamente em inglês (Conventional Commits)
|
|
32
|
-
- 📋 **CHANGELOG Inteligente**: Agrupa commits por tipo e remove duplicatas
|
|
33
|
-
- 🧪 **Modo de Teste**: Teste mudanças com rollback automático
|
|
34
|
-
- 🌍 **Internacionalização**: Suporte automático para 4 idiomas (EN, PT, ES, FR)
|
|
39
|
+
- ✅ Automatically analyzes commits and suggests the correct version
|
|
40
|
+
- ✅ Updates all files at once
|
|
41
|
+
- ✅ Generates organized and complete CHANGELOGs
|
|
42
|
+
- ✅ Creates tags and pushes automatically
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
### ✨ Features
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
- 🔍 **Intelligent Analysis**: Analyzes commit messages and modified files
|
|
47
|
+
- 🎯 **Automatic Suggestion**: Suggests MAJOR, MINOR, or PATCH based on changes
|
|
48
|
+
- 📝 **Automatic Update**: Updates \`package.json\`, \`CHANGELOG.md\`, and code files
|
|
49
|
+
- 🏷️ **Git Tags**: Creates tags automatically and pushes to repository
|
|
50
|
+
- 🤖 **Smart Commit**: Generates commit messages following Conventional Commits
|
|
51
|
+
- 📋 **Intelligent CHANGELOG**: Groups commits by type and removes duplicates
|
|
52
|
+
- 🧪 **Test Mode**: Allows automatic rollback
|
|
53
|
+
- 🌍 **Internationalization**: Support for EN, PT, ES, FR
|
|
39
54
|
|
|
40
|
-
|
|
41
|
-
yarn global add @ridio/version-control
|
|
42
|
-
```
|
|
55
|
+
## 📦 Installation
|
|
43
56
|
|
|
44
|
-
###
|
|
57
|
+
### Global (Recommended)
|
|
45
58
|
|
|
46
|
-
|
|
47
|
-
yarn add
|
|
48
|
-
|
|
59
|
+
\`\`\`bash
|
|
60
|
+
yarn global add @ridiormf/version-control
|
|
61
|
+
# or
|
|
62
|
+
npm install -g @ridiormf/version-control
|
|
63
|
+
\`\`\`
|
|
49
64
|
|
|
50
|
-
###
|
|
65
|
+
### As a development dependency
|
|
51
66
|
|
|
52
|
-
|
|
53
|
-
yarn
|
|
54
|
-
|
|
67
|
+
\`\`\`bash
|
|
68
|
+
yarn add -D @ridiormf/version-control
|
|
69
|
+
# or
|
|
70
|
+
npm install -D @ridiormf/version-control
|
|
71
|
+
\`\`\`
|
|
55
72
|
|
|
56
|
-
|
|
73
|
+
### Using npx (no installation)
|
|
74
|
+
|
|
75
|
+
\`\`\`bash
|
|
76
|
+
npx @ridiormf/version-control
|
|
77
|
+
# or
|
|
78
|
+
yarn dlx @ridiormf/version-control
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
## 🚀 Usage
|
|
57
82
|
|
|
58
83
|
### CLI - Version Control
|
|
59
84
|
|
|
60
|
-
|
|
85
|
+
After making your changes and committing:
|
|
61
86
|
|
|
62
|
-
|
|
87
|
+
\`\`\`bash
|
|
63
88
|
version-control
|
|
64
|
-
|
|
89
|
+
\`\`\`
|
|
65
90
|
|
|
66
|
-
|
|
91
|
+
Or with npx (without installing):
|
|
67
92
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
\`\`\`bash
|
|
94
|
+
npx @ridiormf/version-control
|
|
95
|
+
\`\`\`
|
|
71
96
|
|
|
72
97
|
### CLI - Smart Commit
|
|
73
98
|
|
|
74
|
-
|
|
99
|
+
Intelligent commit with automatic message:
|
|
75
100
|
|
|
76
|
-
|
|
77
|
-
# 1. Faça suas alterações
|
|
78
|
-
vim src/index.ts
|
|
79
|
-
|
|
80
|
-
# 2. Adicione os arquivos
|
|
101
|
+
\`\`\`bash
|
|
81
102
|
git add .
|
|
82
|
-
|
|
83
|
-
# 3. Execute o smart commit
|
|
84
103
|
smart-commit
|
|
85
|
-
|
|
86
|
-
yarn commit
|
|
87
|
-
|
|
88
|
-
# 4. Pressione Enter para aceitar a mensagem gerada
|
|
89
|
-
```
|
|
104
|
+
\`\`\`
|
|
90
105
|
|
|
91
|
-
**
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
═══════════════════════════════════════════════════════════
|
|
95
|
-
Smart Commit - Auto Message
|
|
96
|
-
═══════════════════════════════════════════════════════════
|
|
106
|
+
**Example:**
|
|
97
107
|
|
|
108
|
+
\`\`\`bash
|
|
98
109
|
Staged files: 2
|
|
99
110
|
✨ src/newFeature.ts (+45/-0)
|
|
100
111
|
📝 src/index.ts (+5/-2)
|
|
101
112
|
|
|
102
|
-
Analyzing changes...
|
|
103
|
-
|
|
104
113
|
Generated commit message:
|
|
105
114
|
feat(src): add newFeature
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Scope: src
|
|
110
|
-
Description: add newFeature
|
|
111
|
-
|
|
112
|
-
Options: [1] Commit [2] Edit [3] Cancel (default: 1)
|
|
113
|
-
Choice:
|
|
116
|
+
Options: [1] Commit [2] Edit [3] Cancel
|
|
117
|
+
Choice: 1
|
|
114
118
|
|
|
115
119
|
✓ Commit created successfully!
|
|
116
|
-
|
|
120
|
+
\`\`\`
|
|
117
121
|
|
|
118
|
-
###
|
|
122
|
+
### Adding to package.json
|
|
119
123
|
|
|
120
|
-
|
|
124
|
+
Add a script to your \`package.json\`:
|
|
121
125
|
|
|
122
|
-
|
|
126
|
+
\`\`\`json
|
|
123
127
|
{
|
|
124
128
|
"scripts": {
|
|
125
129
|
"version": "version-control",
|
|
@@ -127,582 +131,266 @@ Adicione um script no seu `package.json`:
|
|
|
127
131
|
"commit": "smart-commit"
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
|
-
|
|
134
|
+
\`\`\`
|
|
131
135
|
|
|
132
|
-
|
|
136
|
+
And run:
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
#
|
|
138
|
+
\`\`\`bash
|
|
139
|
+
# Smart commit
|
|
136
140
|
yarn commit
|
|
137
141
|
|
|
138
|
-
#
|
|
142
|
+
# Normal versioning
|
|
139
143
|
yarn version
|
|
140
144
|
|
|
141
|
-
#
|
|
145
|
+
# Test versioning (allows rollback)
|
|
142
146
|
yarn version:test
|
|
143
|
-
|
|
147
|
+
\`\`\`
|
|
144
148
|
|
|
145
|
-
###
|
|
149
|
+
### Programmatic Usage
|
|
146
150
|
|
|
147
|
-
|
|
151
|
+
Use the library in your custom scripts:
|
|
148
152
|
|
|
149
|
-
|
|
153
|
+
\`\`\`typescript
|
|
150
154
|
import {
|
|
151
155
|
analyzeChanges,
|
|
152
156
|
bumpVersion,
|
|
153
157
|
getCurrentVersion,
|
|
154
|
-
|
|
158
|
+
updatePackageJson,
|
|
159
|
+
updateChangelog,
|
|
160
|
+
executeGitCommands,
|
|
161
|
+
} from "@ridiormf/version-control";
|
|
155
162
|
|
|
156
|
-
//
|
|
163
|
+
// 1. Get current version
|
|
157
164
|
const currentVersion = getCurrentVersion();
|
|
158
|
-
|
|
165
|
+
// Returns: "1.2.3"
|
|
159
166
|
|
|
160
|
-
//
|
|
167
|
+
// 2. Analyze changes from last commit
|
|
161
168
|
const analysis = analyzeChanges();
|
|
162
|
-
|
|
163
|
-
console.log("Razões:", analysis.reason);
|
|
169
|
+
// Returns: { type: 'minor', reason: ['New feature added'], filesChanged: [...], commitMsg: '...' }
|
|
164
170
|
|
|
165
|
-
//
|
|
171
|
+
// 3. Calculate new version
|
|
166
172
|
const newVersion = bumpVersion(currentVersion, analysis.type);
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## 🔧 Como Funciona
|
|
171
|
-
|
|
172
|
-
O sistema analisa as mudanças do último commit do Git e sugere a versão apropriada baseado em:
|
|
173
|
-
|
|
174
|
-
### � Conventional Commits
|
|
175
|
-
|
|
176
|
-
A ferramenta suporta o formato [Conventional Commits](https://www.conventionalcommits.org/), que estrutura as mensagens de commit de forma padronizada:
|
|
177
|
-
|
|
178
|
-
```
|
|
179
|
-
<tipo>(<escopo>): <descrição>
|
|
180
|
-
|
|
181
|
-
[corpo opcional]
|
|
182
|
-
|
|
183
|
-
[rodapé(s) opcional(is)]
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
**Exemplos:**
|
|
187
|
-
|
|
188
|
-
- `feat(auth): add login functionality`
|
|
189
|
-
- `fix: resolve memory leak in cache`
|
|
190
|
-
- `feat!: remove support for Node 12` (breaking change)
|
|
191
|
-
|
|
192
|
-
### 📋 CHANGELOG Inteligente
|
|
193
|
-
|
|
194
|
-
Todos os commits desde a última versão são **automaticamente incluídos** no CHANGELOG, agrupados por tipo:
|
|
195
|
-
|
|
196
|
-
- **✨ Added** - Novas funcionalidades (`feat:`, `add`, `new`)
|
|
197
|
-
- **🐛 Fixed** - Correções de bugs (`fix:`, `bug`)
|
|
198
|
-
- **🔄 Changed** - Mudanças em funcionalidades (`refactor:`, `perf:`)
|
|
199
|
-
- **⚠️ Breaking Changes** - Mudanças incompatíveis (`BREAKING CHANGE`, `!`)
|
|
200
|
-
- **🗑️ Removed** - Remoções (`remove`, `delete`)
|
|
201
|
-
- **🔒 Security** - Correções de segurança (`security`)
|
|
202
|
-
- **⚠️ Deprecated** - Funcionalidades obsoletas (`deprecat`)
|
|
203
|
-
|
|
204
|
-
A ferramenta **remove automaticamente** duplicatas e commits similares, mantendo apenas as entradas mais relevantes.
|
|
205
|
-
|
|
206
|
-
### 🤖 Smart Commit - Mensagens Automáticas
|
|
207
|
-
|
|
208
|
-
O **Smart Commit** analisa os arquivos staged e gera mensagens de commit automaticamente em inglês, seguindo o padrão Conventional Commits:
|
|
209
|
-
|
|
210
|
-
#### Como funciona:
|
|
211
|
-
|
|
212
|
-
1. **Analisa os arquivos**: Detecta arquivos adicionados, modificados ou deletados
|
|
213
|
-
2. **Identifica o tipo**: feat, fix, docs, test, refactor, style, chore
|
|
214
|
-
3. **Detecta o escopo**: Identifica automaticamente (src, api, ui, etc.)
|
|
215
|
-
4. **Gera a descrição**: Baseado nos nomes dos arquivos e padrões de mudança
|
|
216
|
-
|
|
217
|
-
#### Tipos detectados automaticamente:
|
|
173
|
+
// Returns: "1.3.0"
|
|
218
174
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
- **test**: Apenas arquivos de teste
|
|
223
|
-
- **style**: Mudanças pequenas em CSS/SCSS
|
|
224
|
-
- **refactor**: Modificações em código existente
|
|
225
|
-
- **chore**: Configurações e arquivos auxiliares
|
|
175
|
+
// 4. Update files
|
|
176
|
+
updatePackageJson(newVersion);
|
|
177
|
+
updateChangelog(newVersion, analysis.type, analysis);
|
|
226
178
|
|
|
227
|
-
|
|
179
|
+
// 5. Commit and create tag
|
|
180
|
+
executeGitCommands(newVersion);
|
|
181
|
+
\`\`\`
|
|
228
182
|
|
|
229
|
-
|
|
230
|
-
# Adicionar novo arquivo
|
|
231
|
-
git add src/authentication.ts
|
|
232
|
-
yarn commit
|
|
233
|
-
# Gera: feat(src): add authentication
|
|
234
|
-
|
|
235
|
-
# Corrigir bug
|
|
236
|
-
git add src/bugFix.ts
|
|
237
|
-
yarn commit
|
|
238
|
-
# Gera: fix(src): resolve issue in bugFix
|
|
239
|
-
|
|
240
|
-
# Atualizar documentação
|
|
241
|
-
git add README.md
|
|
242
|
-
yarn commit
|
|
243
|
-
# Gera: docs: update README
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
#### 🎉 Versão Inicial (1.0.0)
|
|
247
|
-
|
|
248
|
-
Quando a ferramenta detecta que está gerando a versão **1.0.0** (primeira release), ela adiciona uma mensagem especial no CHANGELOG:
|
|
249
|
-
|
|
250
|
-
```markdown
|
|
251
|
-
## [1.0.0] - 2025-12-24
|
|
183
|
+
## 🔧 How It Works
|
|
252
184
|
|
|
253
|
-
|
|
185
|
+
The system analyzes changes from the last Git commit and suggests the appropriate version based on Conventional Commits format and file changes.
|
|
254
186
|
|
|
255
|
-
|
|
256
|
-
```
|
|
187
|
+
### 🔴 MAJOR (X.0.0) - Breaking Changes
|
|
257
188
|
|
|
258
|
-
|
|
189
|
+
Detected when the commit message contains keywords like:
|
|
259
190
|
|
|
260
|
-
|
|
191
|
+
- \`breaking\`, \`break\`, \`incompatible\`, \`remove\`, \`delete\`, \`rewrite\`
|
|
261
192
|
|
|
262
|
-
|
|
193
|
+
**Example:**
|
|
263
194
|
|
|
264
|
-
|
|
265
|
-
- `incompatível`, `incompatible`
|
|
266
|
-
- `remove`, `delete`
|
|
267
|
-
- `refactor completo`, `rewrite`
|
|
268
|
-
|
|
269
|
-
**Exemplo:**
|
|
270
|
-
|
|
271
|
-
```bash
|
|
195
|
+
\`\`\`bash
|
|
272
196
|
git commit -m "breaking: remove deprecated API methods"
|
|
273
|
-
#
|
|
274
|
-
|
|
197
|
+
# Suggests: 1.5.3 → 2.0.0
|
|
198
|
+
\`\`\`
|
|
275
199
|
|
|
276
|
-
### 🟡 MINOR (x.Y.0) -
|
|
200
|
+
### 🟡 MINOR (x.Y.0) - New Features
|
|
277
201
|
|
|
278
|
-
|
|
202
|
+
Detected when:
|
|
279
203
|
|
|
280
|
-
-
|
|
281
|
-
-
|
|
282
|
-
-
|
|
204
|
+
- Message contains: \`add\`, \`new\`, \`feature\`, \`implement\`, \`create\`
|
|
205
|
+
- New files are added to the project
|
|
206
|
+
- Configuration files are modified
|
|
283
207
|
|
|
284
|
-
**
|
|
208
|
+
**Example:**
|
|
285
209
|
|
|
286
|
-
|
|
210
|
+
\`\`\`bash
|
|
287
211
|
git commit -m "feat: add user authentication module"
|
|
288
|
-
#
|
|
289
|
-
|
|
212
|
+
# Suggests: 1.5.3 → 1.6.0
|
|
213
|
+
\`\`\`
|
|
290
214
|
|
|
291
|
-
### 🟢 PATCH (x.y.Z) -
|
|
215
|
+
### 🟢 PATCH (x.y.Z) - Fixes
|
|
292
216
|
|
|
293
|
-
|
|
217
|
+
Detected when the message contains:
|
|
294
218
|
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
- Pequenas mudanças sem novos arquivos
|
|
219
|
+
- \`fix\`, \`bug\`, \`error\`
|
|
220
|
+
- Small changes without new files
|
|
298
221
|
|
|
299
|
-
**
|
|
222
|
+
**Example:**
|
|
300
223
|
|
|
301
|
-
|
|
224
|
+
\`\`\`bash
|
|
302
225
|
git commit -m "fix: resolve memory leak in cache"
|
|
303
|
-
#
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
### 📊 Entendendo o Impacto de Cada Tipo de Versão
|
|
307
|
-
|
|
308
|
-
Seguindo o [Semantic Versioning (SemVer)](https://semver.org/), cada tipo de versão tem um significado específico e impacta diferentes aspectos do seu projeto:
|
|
309
|
-
|
|
310
|
-
#### 🔴 MAJOR (X.0.0) - Quando usar?
|
|
311
|
-
|
|
312
|
-
**Use MAJOR quando você fizer mudanças incompatíveis na API/interface pública.**
|
|
313
|
-
|
|
314
|
-
**Impactos:**
|
|
315
|
-
|
|
316
|
-
- ⚠️ **Quebra compatibilidade**: Usuários precisarão atualizar o código deles
|
|
317
|
-
- 🔧 **Requer migração**: Pode necessitar guia de migração
|
|
318
|
-
- 📢 **Comunicação crítica**: Deve ser amplamente comunicado
|
|
319
|
-
- 🚨 **Risco alto**: Pode causar falhas em projetos dependentes
|
|
320
|
-
|
|
321
|
-
**Exemplos de mudanças MAJOR:**
|
|
322
|
-
|
|
323
|
-
```javascript
|
|
324
|
-
// ❌ Remover funções/métodos públicos
|
|
325
|
-
- export function oldMethod() { } // Removido
|
|
326
|
-
|
|
327
|
-
// ❌ Mudar assinatura de funções
|
|
328
|
-
- function process(data: string): void
|
|
329
|
-
+ function process(data: object, options: Options): Promise<void>
|
|
330
|
-
|
|
331
|
-
// ❌ Alterar comportamento esperado
|
|
332
|
-
- return { success: true } // Antes retornava objeto
|
|
333
|
-
+ return true // Agora retorna boolean
|
|
334
|
-
|
|
335
|
-
// ❌ Remover ou renomear propriedades públicas
|
|
336
|
-
- interface User { username: string }
|
|
337
|
-
+ interface User { name: string } // Quebra código existente
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
**Quando evitar:** Se possível, adicione a nova funcionalidade sem remover a antiga (deprecated) e só remova na próxima MAJOR.
|
|
341
|
-
|
|
342
|
-
#### 🟡 MINOR (x.Y.0) - Quando usar?
|
|
343
|
-
|
|
344
|
-
**Use MINOR quando você adicionar funcionalidades novas, mantendo compatibilidade com versões anteriores.**
|
|
345
|
-
|
|
346
|
-
**Impactos:**
|
|
347
|
-
|
|
348
|
-
- ✅ **Mantém compatibilidade**: Código existente continua funcionando
|
|
349
|
-
- 🎁 **Adiciona valor**: Novas features disponíveis
|
|
350
|
-
- 📈 **Evolução natural**: Crescimento do projeto
|
|
351
|
-
- 🔄 **Upgrade seguro**: Usuários podem atualizar sem medo
|
|
352
|
-
|
|
353
|
-
**Exemplos de mudanças MINOR:**
|
|
354
|
-
|
|
355
|
-
```javascript
|
|
356
|
-
// ✅ Adicionar novas funções/métodos
|
|
357
|
-
+ export function newFeature() { } // Nova função
|
|
358
|
-
|
|
359
|
-
// ✅ Adicionar novos parâmetros opcionais
|
|
360
|
-
- function process(data: string): void
|
|
361
|
-
+ function process(data: string, options?: Options): void
|
|
362
|
-
|
|
363
|
-
// ✅ Adicionar novas propriedades opcionais
|
|
364
|
-
interface User {
|
|
365
|
-
username: string;
|
|
366
|
-
+ email?: string; // Novo campo opcional
|
|
367
|
-
}
|
|
226
|
+
# Suggests: 1.5.3 → 1.5.4
|
|
227
|
+
\`\`\`
|
|
368
228
|
|
|
369
|
-
|
|
370
|
-
+ export class NewService { } // Nova funcionalidade
|
|
371
|
-
```
|
|
229
|
+
### 📊 Semantic Versioning
|
|
372
230
|
|
|
373
|
-
|
|
231
|
+
\`\`\`
|
|
232
|
+
Breaks existing code?
|
|
233
|
+
├─ YES → 🔴 MAJOR (X.0.0)
|
|
234
|
+
└─ NO → Adds functionality?
|
|
235
|
+
├─ YES → 🟡 MINOR (x.Y.0)
|
|
236
|
+
└─ NO → 🟢 PATCH (x.y.Z)
|
|
237
|
+
\`\`\`
|
|
374
238
|
|
|
375
|
-
|
|
239
|
+
See more at [semver.org](https://semver.org/)
|
|
376
240
|
|
|
377
|
-
|
|
241
|
+
## 📖 Examples
|
|
378
242
|
|
|
379
|
-
|
|
243
|
+
### Typical Flow
|
|
380
244
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
-
|
|
384
|
-
- 🎯 **Foco em estabilidade**: Melhora qualidade sem mudanças
|
|
385
|
-
|
|
386
|
-
**Exemplos de mudanças PATCH:**
|
|
387
|
-
|
|
388
|
-
```javascript
|
|
389
|
-
// ✅ Corrigir bugs
|
|
390
|
-
- if (value > 10) // Bug: deveria ser >=
|
|
391
|
-
+ if (value >= 10)
|
|
392
|
-
|
|
393
|
-
// ✅ Corrigir tipos/documentação
|
|
394
|
-
- * @param value - Must be string // Documentação errada
|
|
395
|
-
+ * @param value - Must be number
|
|
396
|
-
|
|
397
|
-
// ✅ Melhorar performance sem mudar comportamento
|
|
398
|
-
- return items.map(x => x).filter(x => x > 0) // Ineficiente
|
|
399
|
-
+ return items.filter(x => x > 0) // Otimizado
|
|
400
|
-
|
|
401
|
-
// ✅ Corrigir edge cases
|
|
402
|
-
- if (array.length) return array[0] // Falha se length = 0
|
|
403
|
-
+ if (array.length > 0) return array[0]
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
**Quando usar:** Sempre que consertar algo que não estava funcionando corretamente.
|
|
407
|
-
|
|
408
|
-
#### 🎯 Decisão Rápida: Qual versão usar?
|
|
409
|
-
|
|
410
|
-
```
|
|
411
|
-
Quebra código existente?
|
|
412
|
-
├─ SIM → 🔴 MAJOR (X.0.0)
|
|
413
|
-
└─ NÃO → Adiciona nova funcionalidade?
|
|
414
|
-
├─ SIM → 🟡 MINOR (x.Y.0)
|
|
415
|
-
└─ NÃO → 🟢 PATCH (x.y.Z)
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
#### 💡 Dicas Práticas
|
|
419
|
-
|
|
420
|
-
1. **Na dúvida entre MINOR e PATCH:**
|
|
421
|
-
|
|
422
|
-
- Se adiciona qualquer coisa nova (função, parâmetro, propriedade) → MINOR
|
|
423
|
-
- Se apenas corrige comportamento → PATCH
|
|
424
|
-
|
|
425
|
-
2. **Evite MAJOR sempre que possível:**
|
|
426
|
-
|
|
427
|
-
- Use `@deprecated` para marcar código antigo
|
|
428
|
-
- Mantenha compatibilidade por 1-2 versões MINOR antes de remover
|
|
429
|
-
|
|
430
|
-
3. **Pre-releases (0.x.x):**
|
|
245
|
+
\`\`\`bash
|
|
246
|
+
git commit -m "feat: add new export functionality"
|
|
247
|
+
version-control
|
|
431
248
|
|
|
432
|
-
|
|
433
|
-
|
|
249
|
+
# Current version: 1.2.3
|
|
250
|
+
# Suggested type: MINOR
|
|
251
|
+
# New version: 1.3.0
|
|
252
|
+
#
|
|
253
|
+
# Update version? (y/n): y
|
|
254
|
+
#
|
|
255
|
+
# ✓ package.json updated
|
|
256
|
+
# ✓ CHANGELOG.md updated
|
|
257
|
+
# ✓ Tag v1.3.0 created
|
|
258
|
+
# ✓ Version 1.3.0 published!
|
|
259
|
+
\`\`\`
|
|
434
260
|
|
|
435
|
-
|
|
436
|
-
- Representa a primeira versão estável
|
|
437
|
-
- A partir dela, siga SemVer rigorosamente
|
|
261
|
+
## 📚 API
|
|
438
262
|
|
|
439
|
-
|
|
263
|
+
### Available Methods
|
|
440
264
|
|
|
441
|
-
|
|
265
|
+
#### Analysis and Versioning
|
|
442
266
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
267
|
+
- \`analyzeChanges()\` - Analyzes last commit and suggests version type
|
|
268
|
+
- \`getCurrentVersion(projectRoot?)\` - Returns current version from package.json
|
|
269
|
+
- \`bumpVersion(currentVersion, type)\` - Calculates new version
|
|
446
270
|
|
|
447
|
-
|
|
448
|
-
git commit -m "feat: add new export functionality"
|
|
271
|
+
#### File Updates
|
|
449
272
|
|
|
450
|
-
|
|
451
|
-
version
|
|
273
|
+
- \`updatePackageJson(newVersion, projectRoot?)\` - Updates package.json
|
|
274
|
+
- \`updateIndexFile(newVersion, projectRoot?)\` - Updates @version in code files
|
|
275
|
+
- \`updateChangelog(version, type, analysis, projectRoot?)\` - Updates CHANGELOG.md
|
|
452
276
|
|
|
453
|
-
|
|
454
|
-
# ═══════════════════════════════════════════════════════════
|
|
455
|
-
# Sistema de Controle de Versão
|
|
456
|
-
# ═══════════════════════════════════════════════════════════
|
|
457
|
-
#
|
|
458
|
-
# Versão atual: 1.2.3
|
|
459
|
-
#
|
|
460
|
-
# Analisando último commit...
|
|
461
|
-
#
|
|
462
|
-
# Mensagem do commit:
|
|
463
|
-
# "feat: add new export functionality"
|
|
464
|
-
#
|
|
465
|
-
# Arquivos modificados: 2
|
|
466
|
-
# - src/index.ts
|
|
467
|
-
# - src/exporter.ts
|
|
468
|
-
#
|
|
469
|
-
# Análise da mudança:
|
|
470
|
-
# 🟡 Commit indica nova funcionalidade
|
|
471
|
-
#
|
|
472
|
-
# Tipo sugerido: 🟡 MINOR
|
|
473
|
-
# Nova versão: 1.2.3 → 1.3.0
|
|
474
|
-
#
|
|
475
|
-
# Deseja atualizar a versão? (s/n): s
|
|
476
|
-
#
|
|
477
|
-
# Confirme o tipo de versão:
|
|
478
|
-
# 1 - MAJOR (2.0.0) - Breaking changes
|
|
479
|
-
# 2 - MINOR (1.3.0) - Nova funcionalidade
|
|
480
|
-
# 3 - PATCH (1.2.4) - Correção de bug
|
|
481
|
-
#
|
|
482
|
-
# Escolha (1/2/3) [padrão: 2]:
|
|
483
|
-
#
|
|
484
|
-
# Atualizando arquivos...
|
|
485
|
-
# ✓ package.json atualizado
|
|
486
|
-
# ✓ CHANGELOG.md atualizado
|
|
487
|
-
#
|
|
488
|
-
# ✓ Versão atualizada para 1.3.0!
|
|
489
|
-
#
|
|
490
|
-
# Executando comandos git...
|
|
491
|
-
# → git add -A
|
|
492
|
-
# ✓ Arquivos adicionados
|
|
493
|
-
# → git commit -m "chore: bump version to 1.3.0"
|
|
494
|
-
# ✓ Commit criado
|
|
495
|
-
# → git tag v1.3.0
|
|
496
|
-
# ✓ Tag criada
|
|
497
|
-
# → git push
|
|
498
|
-
# ✓ Push realizado
|
|
499
|
-
# → git push --tags
|
|
500
|
-
# ✓ Tags enviadas
|
|
501
|
-
#
|
|
502
|
-
# ✓ Versão 1.3.0 publicada com sucesso!
|
|
503
|
-
```
|
|
277
|
+
#### Commit and Git
|
|
504
278
|
|
|
505
|
-
|
|
279
|
+
- \`executeGitCommands(version)\` - Creates commit, tag, and pushes
|
|
280
|
+
- \`getStagedChanges()\` - Lists staged files
|
|
281
|
+
- \`generateCommitMessage(changes)\` - Generates automatic commit message
|
|
506
282
|
|
|
507
|
-
|
|
283
|
+
#### Configuration
|
|
508
284
|
|
|
509
|
-
|
|
510
|
-
|
|
285
|
+
- \`getConfiguredLanguage()\` - Returns configured language
|
|
286
|
+
- \`setLanguage(lang)\` - Sets language manually
|
|
287
|
+
- \`clearConfig()\` - Removes configuration
|
|
511
288
|
|
|
512
|
-
|
|
513
|
-
# Escolha (1/2/3) [padrão: 3]: 2
|
|
514
|
-
```
|
|
289
|
+
---
|
|
515
290
|
|
|
516
|
-
|
|
291
|
+
### Details
|
|
517
292
|
|
|
518
|
-
|
|
293
|
+
#### \`analyzeChanges(): ChangeAnalysis\`
|
|
519
294
|
|
|
520
|
-
|
|
295
|
+
Analyzes the last commit and returns an analysis of the changes.
|
|
521
296
|
|
|
522
|
-
**
|
|
297
|
+
**Returns:**
|
|
523
298
|
|
|
524
|
-
|
|
299
|
+
\`\`\`typescript
|
|
525
300
|
interface ChangeAnalysis {
|
|
526
301
|
type: "major" | "minor" | "patch";
|
|
527
302
|
reason: string[];
|
|
528
303
|
filesChanged: string[];
|
|
529
304
|
commitMsg: string;
|
|
530
305
|
}
|
|
531
|
-
|
|
306
|
+
\`\`\`
|
|
532
307
|
|
|
533
|
-
|
|
308
|
+
#### \`getCurrentVersion(projectRoot?: string): string\`
|
|
534
309
|
|
|
535
|
-
|
|
310
|
+
Returns the current version from \`package.json\`.
|
|
536
311
|
|
|
537
|
-
**
|
|
312
|
+
**Parameters:**
|
|
538
313
|
|
|
539
|
-
-
|
|
314
|
+
- \`projectRoot\` (optional): Project root path (default: \`process.cwd()\`)
|
|
540
315
|
|
|
541
|
-
|
|
316
|
+
#### \`bumpVersion(currentVersion: string, type: VersionType): string\`
|
|
542
317
|
|
|
543
|
-
|
|
318
|
+
Calculates the new version based on the bump type.
|
|
544
319
|
|
|
545
|
-
**
|
|
320
|
+
**Parameters:**
|
|
546
321
|
|
|
547
|
-
-
|
|
548
|
-
-
|
|
322
|
+
- \`currentVersion\`: Current version (e.g., "1.2.3")
|
|
323
|
+
- \`type\`: Bump type (\`'major'\`, \`'minor'\`, or \`'patch'\`)
|
|
549
324
|
|
|
550
|
-
**
|
|
325
|
+
**Example:**
|
|
551
326
|
|
|
552
|
-
|
|
327
|
+
\`\`\`typescript
|
|
553
328
|
bumpVersion("1.2.3", "major"); // "2.0.0"
|
|
554
329
|
bumpVersion("1.2.3", "minor"); // "1.3.0"
|
|
555
330
|
bumpVersion("1.2.3", "patch"); // "1.2.4"
|
|
556
|
-
|
|
331
|
+
\`\`\`
|
|
557
332
|
|
|
558
|
-
##
|
|
333
|
+
## 🌍 Internationalization
|
|
559
334
|
|
|
560
|
-
|
|
335
|
+
The tool automatically detects the system language and adjusts all messages accordingly.
|
|
561
336
|
|
|
562
|
-
###
|
|
337
|
+
### Supported Languages
|
|
563
338
|
|
|
564
|
-
- 🇬🇧 **
|
|
565
|
-
- 🇧🇷 **
|
|
566
|
-
- 🇪🇸 **
|
|
567
|
-
- 🇫🇷 **
|
|
339
|
+
- 🇬🇧 **English (EN)** - Default
|
|
340
|
+
- 🇧🇷 **Portuguese (PT)** - pt_BR, pt_PT
|
|
341
|
+
- 🇪🇸 **Spanish (ES)** - es_ES, es_MX, etc.
|
|
342
|
+
- 🇫🇷 **French (FR)** - fr_FR, fr_CA, etc.
|
|
568
343
|
|
|
569
|
-
###
|
|
344
|
+
### Manual Language Configuration
|
|
570
345
|
|
|
571
|
-
|
|
572
|
-
#
|
|
346
|
+
\`\`\`bash
|
|
347
|
+
# Configure to Portuguese
|
|
573
348
|
version-control config --lang pt
|
|
574
349
|
|
|
575
|
-
#
|
|
350
|
+
# Configure to English
|
|
576
351
|
version-control config --lang en
|
|
577
352
|
|
|
578
|
-
#
|
|
353
|
+
# Configure to Spanish
|
|
579
354
|
version-control config --lang es
|
|
580
355
|
|
|
581
|
-
#
|
|
356
|
+
# Configure to French
|
|
582
357
|
version-control config --lang fr
|
|
583
358
|
|
|
584
|
-
#
|
|
359
|
+
# Clear configuration (returns to automatic detection)
|
|
585
360
|
version-control config --clear
|
|
586
361
|
|
|
587
|
-
#
|
|
362
|
+
# View current configuration
|
|
588
363
|
version-control config
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
A configuração é salva globalmente em `~/.version-control-config.json` e será usada em todos os projetos.
|
|
592
|
-
|
|
593
|
-
### Como Funciona
|
|
594
|
-
|
|
595
|
-
1. **Configuração Manual**: Se você configurou um idioma com `version-control config --lang`, ele será usado
|
|
596
|
-
2. **Detecção Automática**: Se não houver configuração, detecta do sistema via `LANG`, `LANGUAGE`, `LC_ALL`
|
|
597
|
-
3. **Fallback**: Se o idioma não for suportado, usa inglês automaticamente
|
|
598
|
-
|
|
599
|
-
**Indicador de Idioma:**
|
|
600
|
-
|
|
601
|
-
Toda vez que você executar `version-control` ou `smart-commit`, verá uma linha informando:
|
|
602
|
-
|
|
603
|
-
```bash
|
|
604
|
-
ℹ Current language: PT (manually configured)
|
|
605
|
-
To change language: version-control config --lang <code>
|
|
606
|
-
```
|
|
607
|
-
|
|
608
|
-
ou
|
|
609
|
-
|
|
610
|
-
```bash
|
|
611
|
-
ℹ Idioma atual: PT (detectado do sistema)
|
|
612
|
-
Para mudar o idioma: version-control config --lang <code>
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### Detecção Automática do Sistema
|
|
616
|
-
|
|
617
|
-
A detecção é automática baseada nas variáveis de ambiente do sistema:
|
|
364
|
+
\`\`\`
|
|
618
365
|
|
|
619
|
-
-
|
|
620
|
-
- `LANGUAGE`
|
|
621
|
-
- `LC_ALL`
|
|
366
|
+
The configuration is saved globally in \`~/.version-control-config.json\` and will be used in all projects.
|
|
622
367
|
|
|
623
|
-
|
|
368
|
+
## 🎯 Keywords
|
|
624
369
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
# Output: "Versão atual: 1.0.0"
|
|
629
|
-
# Output: "Deseja atualizar a versão? (s/n):"
|
|
370
|
+
- **MAJOR**: \`breaking\`, \`remove\`, \`delete\`, \`rewrite\`
|
|
371
|
+
- **MINOR**: \`add\`, \`new\`, \`feature\`, \`implement\`
|
|
372
|
+
- **PATCH**: \`fix\`, \`bug\`, \`error\`
|
|
630
373
|
|
|
631
|
-
|
|
632
|
-
LANG=en_US.UTF-8 version-control
|
|
633
|
-
# Output: "Current version: 1.0.0"
|
|
634
|
-
# Output: "Update version? (y/n):"
|
|
374
|
+
## 🤝 Contributing
|
|
635
375
|
|
|
636
|
-
|
|
637
|
-
LANG=es_ES.UTF-8 version-control
|
|
638
|
-
# Output: "Versión actual: 1.0.0"
|
|
639
|
-
# Output: "¿Actualizar versión? (s/n):"
|
|
376
|
+
Contributions are welcome! Feel free to:
|
|
640
377
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
378
|
+
1. Fork the project
|
|
379
|
+
2. Create a branch for your feature (\`git checkout -b feature/AmazingFeature\`)
|
|
380
|
+
3. Commit your changes (\`git commit -m 'feat: add some AmazingFeature'\`)
|
|
381
|
+
4. Push to the branch (\`git push origin feature/AmazingFeature\`)
|
|
382
|
+
5. Open a Pull Request
|
|
646
383
|
|
|
647
|
-
|
|
384
|
+
## 📄 License
|
|
648
385
|
|
|
649
|
-
|
|
386
|
+
This project is under the MIT license. See the [LICENSE](LICENSE) file for more details.
|
|
650
387
|
|
|
651
|
-
|
|
652
|
-
# Sistema em alemão (não suportado)
|
|
653
|
-
LANG=de_DE.UTF-8 version-control
|
|
654
|
-
# Output em inglês: "Current version: 1.0.0"
|
|
655
|
-
```
|
|
656
|
-
|
|
657
|
-
## �🎨 Palavras-chave Reconhecidas
|
|
658
|
-
|
|
659
|
-
### Breaking Changes (MAJOR)
|
|
660
|
-
|
|
661
|
-
- `breaking`, `break`
|
|
662
|
-
- `incompatível`, `incompatible`
|
|
663
|
-
- `remove`, `remov`, `delete`, `delet`
|
|
664
|
-
- `refactor completo`, `reescrita`, `rewrite`
|
|
665
|
-
|
|
666
|
-
### Novas Funcionalidades (MINOR)
|
|
667
|
-
|
|
668
|
-
- `add`, `adicion`
|
|
669
|
-
- `nova`, `novo`, `new`
|
|
670
|
-
- `feature`, `implement`
|
|
671
|
-
- `criar`, `create`, `funcionalidade`
|
|
672
|
-
|
|
673
|
-
### Correções (PATCH)
|
|
674
|
-
|
|
675
|
-
- `fix`, `corrig`
|
|
676
|
-
- `bug`, `erro`, `error`
|
|
677
|
-
- `ajust`, `ajeit`, `pequen`
|
|
678
|
-
- `minor change`
|
|
679
|
-
|
|
680
|
-
## 🤝 Contribuindo
|
|
681
|
-
|
|
682
|
-
Contribuições são bem-vindas! Sinta-se à vontade para:
|
|
683
|
-
|
|
684
|
-
1. Fazer fork do projeto
|
|
685
|
-
2. Criar uma branch para sua feature (`git checkout -b feature/AmazingFeature`)
|
|
686
|
-
3. Commit suas mudanças (`git commit -m 'feat: add some AmazingFeature'`)
|
|
687
|
-
4. Push para a branch (`git push origin feature/AmazingFeature`)
|
|
688
|
-
5. Abrir um Pull Request
|
|
689
|
-
|
|
690
|
-
## 📄 Licença
|
|
691
|
-
|
|
692
|
-
Este projeto está sob a licença MIT. Veja o arquivo [LICENSE](LICENSE) para mais detalhes.
|
|
693
|
-
|
|
694
|
-
## 👤 Autor
|
|
388
|
+
## 👤 Author
|
|
695
389
|
|
|
696
390
|
**Ridio Ricardo**
|
|
697
391
|
|
|
698
392
|
- GitHub: [@ridioricardo](https://github.com/ridioricardo)
|
|
699
393
|
|
|
700
|
-
## 🙏 Agradecimentos
|
|
701
|
-
|
|
702
|
-
- Inspirado nas melhores práticas de versionamento semântico
|
|
703
|
-
- Construído com TypeScript para melhor experiência de desenvolvimento
|
|
704
|
-
- Baseado nas especificações do [Semantic Versioning 2.0.0](https://semver.org/)
|
|
705
|
-
|
|
706
394
|
---
|
|
707
395
|
|
|
708
|
-
|
|
396
|
+
Based on [Semantic Versioning 2.0.0](https://semver.org/) specifications
|