@codigodoleo/wp-kit 4.0.0 → 5.0.0
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/modules/docs/index.js +42 -2
- package/modules/docs/templates/README.md.hbs +33 -160
- package/modules/docs/templates/docs/Arquitetura.md.hbs +74 -388
- package/modules/docs/templates/docs/Deploy-Pipeline.md.hbs +60 -102
- package/modules/docs/templates/docs/Desenvolvimento.md.hbs +87 -1099
- package/modules/docs/templates/docs/Getting-Started.md.hbs +50 -490
- package/modules/docs/templates/docs/Infraestrutura.md.hbs +45 -220
- package/modules/docs/templates/docs/Monitoramento.md.hbs +39 -322
- package/modules/docs/templates/docs/Sync-the-Production-DB-with-the-Staging-DB.md.hbs +68 -7
- package/modules/docs/templates/docs/Troubleshooting.md.hbs +64 -2
- package/modules/mu-plugin/index.js +5 -5
- package/modules/mu-plugin/prompts.js +1 -1
- package/package.json +1 -1
|
@@ -1,1139 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Desenvolvimento
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workflow and conventions for working on **{{projectTitle}}**.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Git workflow
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
This project follows a **GitFlow-derived workflow** with three long-lived
|
|
8
|
+
branches and short-lived branches per piece of work. Adjust to your
|
|
9
|
+
team's needs — the structure below is a sensible default.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
| Branch | Purpose | Auto-deploys to |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `main` (or `master`) | Production-ready code | {{projectProductionDomain}} |
|
|
14
|
+
| `staging` | Pre-production validation | {{projectStagingDomain}} |
|
|
15
|
+
| `development` | Integration of in-flight features | {{projectDevDomain}} |
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
graph LR
|
|
13
|
-
A[master] --> B[feature/new-feature]
|
|
14
|
-
A --> C[feature/another-feature]
|
|
15
|
-
A --> D[hotfix/critical-fix]
|
|
16
|
-
A --> E[release/v1.2.0]
|
|
17
|
-
|
|
18
|
-
B --> F[MR to development]
|
|
19
|
-
C --> F
|
|
20
|
-
E --> G[MR to staging]
|
|
21
|
-
F --> H[development]
|
|
22
|
-
G --> I[staging]
|
|
23
|
-
H --> J[MR to staging]
|
|
24
|
-
J --> I
|
|
25
|
-
I --> K[MR to master]
|
|
26
|
-
K --> L[master]
|
|
27
|
-
|
|
28
|
-
D --> M[MR to master]
|
|
29
|
-
M --> L
|
|
30
|
-
D --> N[MR to development]
|
|
31
|
-
N --> H
|
|
32
|
-
|
|
33
|
-
style A fill:#ff6b6b
|
|
34
|
-
style H fill:#feca57
|
|
35
|
-
style I fill:#48dbfb
|
|
36
|
-
style L fill:#1dd1a1
|
|
37
|
-
```
|
|
17
|
+
### Branch types
|
|
38
18
|
|
|
39
|
-
|
|
19
|
+
| Prefix | From | To | Purpose |
|
|
20
|
+
| --- | --- | --- | --- |
|
|
21
|
+
| `feature/` | `main` | `development` (via {{prTermShort}}) | New functionality |
|
|
22
|
+
| `bugfix/` | `main` | `development` (via {{prTermShort}}) | Non-critical fixes |
|
|
23
|
+
| `hotfix/` | `main` | `main` + `development` (via {{prTermShort}}) | Critical production fixes |
|
|
24
|
+
| `release/` | `main` | `staging` → `main` (via {{prTermShort}}) | Release preparation |
|
|
25
|
+
| `chore/` | `main` | `development` (via {{prTermShort}}) | Maintenance, deps, docs |
|
|
40
26
|
|
|
41
|
-
|
|
42
|
-
| ----------- | ---------- | -------- | ------------------------ | --------- | ---------------------- |
|
|
43
|
-
| **Feature** | `feature/` | `master` | `development` | **MR** | Novas funcionalidades |
|
|
44
|
-
| **Bugfix** | `bugfix/` | `master` | `development` | **MR** | Correções não-críticas |
|
|
45
|
-
| **Hotfix** | `hotfix/` | `master` | `master` + `development` | **MR** | Correções críticas |
|
|
46
|
-
| **Release** | `release/` | `master` | `staging` → `master` | **MR** | Preparação de releases |
|
|
47
|
-
| **Chore** | `chore/` | `master` | `development` | **MR** | Manutenção, docs, etc. |
|
|
27
|
+
### Naming
|
|
48
28
|
|
|
49
|
-
|
|
29
|
+
Use kebab-case in English; the prefix carries the intent.
|
|
50
30
|
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
release/v1.2.0
|
|
58
|
-
chore/update-dependencies
|
|
59
|
-
|
|
60
|
-
# ❌ Incorreto
|
|
61
|
-
feature/autenticacao-usuario
|
|
62
|
-
feature/NewFeature
|
|
63
|
-
bugfix/bug_fix
|
|
64
|
-
feature-payment
|
|
31
|
+
```text
|
|
32
|
+
feature/user-profile-avatar
|
|
33
|
+
bugfix/header-overlap-on-mobile
|
|
34
|
+
hotfix/auth-bypass-cve-2025-1234
|
|
35
|
+
chore/bump-composer-deps
|
|
36
|
+
release/v1.4.0
|
|
65
37
|
```
|
|
66
38
|
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
### **1. Criando uma Nova Feature**
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# 1. Sempre partir da master atualizada
|
|
73
|
-
git checkout master
|
|
74
|
-
git pull origin master
|
|
75
|
-
|
|
76
|
-
# 2. Criar branch seguindo padrão
|
|
77
|
-
git checkout -b feature/user-profile-enhancement
|
|
78
|
-
|
|
79
|
-
# 3. Desenvolver com commits bem documentados
|
|
80
|
-
git add .
|
|
81
|
-
git commit -m "feat: add user profile avatar upload functionality"
|
|
82
|
-
|
|
83
|
-
# 4. Push da branch
|
|
84
|
-
git push origin feature/user-profile-enhancement
|
|
85
|
-
|
|
86
|
-
# 5. Criar Merge Request para development (OBRIGATÓRIO)
|
|
87
|
-
# Via GitLab interface - NUNCA merge direto
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### **2. Fluxo de Merge Requests (Processo Obrigatório)**
|
|
39
|
+
## Feature flow
|
|
91
40
|
|
|
92
41
|
```mermaid
|
|
93
42
|
graph TD
|
|
94
|
-
A[
|
|
95
|
-
B --> C[Code
|
|
96
|
-
C --> D{
|
|
97
|
-
D
|
|
43
|
+
A[feature/branch off main] --> B[Open {{prTermShort}} -> development]
|
|
44
|
+
B --> C[Code review]
|
|
45
|
+
C --> D{Approved?}
|
|
46
|
+
D -- No --> E[Address feedback]
|
|
98
47
|
E --> C
|
|
99
|
-
D
|
|
100
|
-
F --> G[Auto
|
|
101
|
-
G --> H[QA
|
|
102
|
-
H --> I[
|
|
103
|
-
I --> J[
|
|
104
|
-
J --> K[
|
|
105
|
-
K --> L[
|
|
106
|
-
L --> M[
|
|
107
|
-
M --> N[
|
|
108
|
-
N --> O[
|
|
109
|
-
O --> P[✅ Merge to master via MR]
|
|
110
|
-
P --> Q[Deploy to {{projectProductionDomain}}]
|
|
111
|
-
|
|
112
|
-
style F fill:#1dd1a1
|
|
113
|
-
style K fill:#1dd1a1
|
|
114
|
-
style P fill:#1dd1a1
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### **3. Preparação de Release (Via Merge Requests)**
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# 1. Criar branch de release a partir da master
|
|
121
|
-
git checkout master
|
|
122
|
-
git pull origin master
|
|
123
|
-
git checkout -b release/v1.2.0
|
|
124
|
-
|
|
125
|
-
# 2. Atualizar versões e changelog
|
|
126
|
-
# - Atualizar version em style.css
|
|
127
|
-
# - Atualizar CHANGELOG.md
|
|
128
|
-
# - Commit de preparação
|
|
129
|
-
|
|
130
|
-
git add .
|
|
131
|
-
git commit -m "chore: prepare release v1.2.0"
|
|
132
|
-
git push origin release/v1.2.0
|
|
133
|
-
|
|
134
|
-
# 3. MERGE REQUEST para staging (OBRIGATÓRIO)
|
|
135
|
-
# Via GitLab interface:
|
|
136
|
-
# - Create MR: release/v1.2.0 → staging
|
|
137
|
-
# - Assign reviewers
|
|
138
|
-
# - Wait for approval
|
|
139
|
-
# - Merge via MR
|
|
140
|
-
|
|
141
|
-
# 4. Após validação em staging, MERGE REQUEST para master (OBRIGATÓRIO)
|
|
142
|
-
# Via GitLab interface:
|
|
143
|
-
# - Create MR: staging → master
|
|
144
|
-
# - Assign senior reviewers
|
|
145
|
-
# - Wait for approval
|
|
146
|
-
# - Merge via MR
|
|
147
|
-
|
|
148
|
-
# 5. Criar tag (APÓS merge para master)
|
|
149
|
-
git checkout master
|
|
150
|
-
git pull origin master
|
|
151
|
-
git tag -a v1.2.0 -m "Release version 1.2.0"
|
|
152
|
-
git push origin v1.2.0
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### **4. Processo de Hotfix (Via Merge Requests)**
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
# 1. Criar hotfix a partir da master
|
|
159
|
-
git checkout master
|
|
160
|
-
git pull origin master
|
|
161
|
-
git checkout -b hotfix/critical-security-patch
|
|
162
|
-
|
|
163
|
-
# 2. Implementar correção crítica
|
|
164
|
-
git add .
|
|
165
|
-
git commit -m "fix: patch critical security vulnerability in user authentication"
|
|
166
|
-
git push origin hotfix/critical-security-patch
|
|
167
|
-
|
|
168
|
-
# 3. DUAS Merge Requests simultâneas (OBRIGATÓRIO)
|
|
169
|
-
#
|
|
170
|
-
# MR 1: hotfix → master (para produção imediata)
|
|
171
|
-
# - Create MR: hotfix/critical-security-patch → master
|
|
172
|
-
# - Assign senior reviewers
|
|
173
|
-
# - Mark as URGENT
|
|
174
|
-
# - Merge after approval
|
|
175
|
-
#
|
|
176
|
-
# MR 2: hotfix → development (para sincronização)
|
|
177
|
-
# - Create MR: hotfix/critical-security-patch → development
|
|
178
|
-
# - Assign reviewers
|
|
179
|
-
# - Merge after MR 1 is completed
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## 📋 **Merge Request Guidelines**
|
|
183
|
-
|
|
184
|
-
### **Template de Merge Request**
|
|
185
|
-
|
|
186
|
-
```markdown
|
|
187
|
-
## 🎯 Merge Request Title
|
|
188
|
-
|
|
189
|
-
Brief description of changes
|
|
190
|
-
|
|
191
|
-
## 📝 Description
|
|
192
|
-
|
|
193
|
-
Detailed description of what this MR does and why.
|
|
194
|
-
|
|
195
|
-
## 🔗 Related Issues
|
|
196
|
-
|
|
197
|
-
- Closes #123
|
|
198
|
-
- Relates to #456
|
|
199
|
-
|
|
200
|
-
## 🧪 Testing
|
|
201
|
-
|
|
202
|
-
- [ ] Unit tests pass
|
|
203
|
-
- [ ] Integration tests pass
|
|
204
|
-
- [ ] Manual testing completed
|
|
205
|
-
- [ ] Tested in local environment
|
|
206
|
-
|
|
207
|
-
## 📋 Checklist
|
|
208
|
-
|
|
209
|
-
- [ ] Code follows project standards
|
|
210
|
-
- [ ] All tests pass
|
|
211
|
-
- [ ] Documentation updated
|
|
212
|
-
- [ ] CHANGELOG.md updated (if user-facing)
|
|
213
|
-
- [ ] No breaking changes (or properly documented)
|
|
214
|
-
|
|
215
|
-
## 🖼️ Screenshots (if applicable)
|
|
216
|
-
|
|
217
|
-
Before/After screenshots for UI changes
|
|
218
|
-
|
|
219
|
-
## 🚀 Deployment Notes
|
|
220
|
-
|
|
221
|
-
Any special deployment considerations
|
|
222
|
-
|
|
223
|
-
## 👥 Reviewers
|
|
224
|
-
|
|
225
|
-
@senior-dev @team-lead
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### **Aprovações Obrigatórias por Branch**
|
|
229
|
-
|
|
230
|
-
| Target Branch | Reviewers Required | Auto-merge | Finalidade |
|
|
231
|
-
| --------------- | ---------------------- | ---------- | ------------------- |
|
|
232
|
-
| **development** | 1 senior dev | ❌ | Features, bugfixes |
|
|
233
|
-
| **staging** | 2 senior devs | ❌ | Release preparation |
|
|
234
|
-
| **master** | 2 senior devs + 1 lead | ❌ | Production releases |
|
|
235
|
-
|
|
236
|
-
### **Configuração GitLab (Merge Request Rules)**
|
|
237
|
-
|
|
238
|
-
```yaml
|
|
239
|
-
# .gitlab/merge_request_templates/default.md
|
|
240
|
-
push_rules:
|
|
241
|
-
development:
|
|
242
|
-
required_approvals: 1
|
|
243
|
-
required_approval_groups: ['senior-developers']
|
|
244
|
-
allow_force_push: false
|
|
245
|
-
|
|
246
|
-
staging:
|
|
247
|
-
required_approvals: 2
|
|
248
|
-
required_approval_groups: ['senior-developers']
|
|
249
|
-
allow_force_push: false
|
|
250
|
-
require_code_owner_reviews: true
|
|
251
|
-
|
|
252
|
-
master:
|
|
253
|
-
required_approvals: 2
|
|
254
|
-
required_approval_groups: ['senior-developers', 'tech-leads']
|
|
255
|
-
allow_force_push: false
|
|
256
|
-
require_code_owner_reviews: true
|
|
257
|
-
dismiss_stale_reviews: true
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
## 🚫 **Práticas Proibidas**
|
|
261
|
-
|
|
262
|
-
### **❌ Nunca Fazer**
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
# ❌ PROIBIDO: Merge direto sem MR
|
|
266
|
-
git checkout staging
|
|
267
|
-
git merge development # NUNCA!
|
|
268
|
-
|
|
269
|
-
# ❌ PROIBIDO: Push direto para branches protegidas
|
|
270
|
-
git push origin master # NUNCA!
|
|
271
|
-
|
|
272
|
-
# ❌ PROIBIDO: Commits diretos em branches protegidas
|
|
273
|
-
git checkout master
|
|
274
|
-
git commit -m "quick fix" # NUNCA!
|
|
275
|
-
|
|
276
|
-
# ❌ PROIBIDO: Force push em branches compartilhadas
|
|
277
|
-
git push --force origin development # NUNCA!
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### **✅ Sempre Fazer**
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
# ✅ CORRETO: Sempre via Merge Request
|
|
284
|
-
# 1. Create branch
|
|
285
|
-
git checkout -b feature/my-feature
|
|
286
|
-
|
|
287
|
-
# 2. Develop and commit
|
|
288
|
-
git commit -m "feat: add new functionality"
|
|
289
|
-
|
|
290
|
-
# 3. Push branch
|
|
291
|
-
git push origin feature/my-feature
|
|
292
|
-
|
|
293
|
-
# 4. Create MR via GitLab interface
|
|
294
|
-
# 5. Wait for review and approval
|
|
295
|
-
# 6. Merge via GitLab interface
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## 📦 **Gerenciamento de Dependências com Composer**
|
|
299
|
-
|
|
300
|
-
### **Configuração do Composer**
|
|
301
|
-
|
|
302
|
-
```json
|
|
303
|
-
{
|
|
304
|
-
"name": "{{projectName}}/wordpress-website",
|
|
305
|
-
"description": "{{projectTitle}} WordPress Website",
|
|
306
|
-
"type": "project",
|
|
307
|
-
"require": {
|
|
308
|
-
"php": ">=8.0",
|
|
309
|
-
"composer/installers": "^2.0",
|
|
310
|
-
"wpackagist-plugin/advanced-custom-fields-pro": "*",
|
|
311
|
-
"wpackagist-plugin/wp-rocket": "*"
|
|
312
|
-
},
|
|
313
|
-
"require-dev": {
|
|
314
|
-
"phpunit/phpunit": "^9.0",
|
|
315
|
-
"squizlabs/php_codesniffer": "*",
|
|
316
|
-
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
|
317
|
-
"wp-coding-standards/wpcs": "*"
|
|
318
|
-
},
|
|
319
|
-
"repositories": [
|
|
320
|
-
{
|
|
321
|
-
"type": "composer",
|
|
322
|
-
"url": "https://wpackagist.org"
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
"type": "package",
|
|
326
|
-
"package": {
|
|
327
|
-
"name": "advanced-custom-fields/advanced-custom-fields-pro",
|
|
328
|
-
"version": "6.0.0",
|
|
329
|
-
"type": "wordpress-plugin",
|
|
330
|
-
"dist": {
|
|
331
|
-
"type": "zip",
|
|
332
|
-
"url": "https://connect.advancedcustomfields.com/..."
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
],
|
|
337
|
-
"extra": {
|
|
338
|
-
"installer-paths": {
|
|
339
|
-
"dist/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
|
|
340
|
-
"dist/wp-content/themes/{$name}/": ["type:wordpress-theme"]
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
"autoload": {
|
|
344
|
-
"psr-4": {
|
|
345
|
-
"{{projectPascal}}\\": "dist/wp-content/themes/{{projectThemeSlug}}/inc/"
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
"scripts": {
|
|
349
|
-
"install-plugins": "composer install --no-dev",
|
|
350
|
-
"test": "phpunit",
|
|
351
|
-
"lint": "phpcs --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/",
|
|
352
|
-
"format": "phpcbf --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/"
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### **Instalação de Plugins**
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
# Plugins do repositório WordPress.org
|
|
361
|
-
composer require wpackagist-plugin/contact-form-7
|
|
362
|
-
|
|
363
|
-
# Plugins premium (configurar repositório privado)
|
|
364
|
-
composer require advanced-custom-fields/advanced-custom-fields-pro
|
|
365
|
-
|
|
366
|
-
# Plugins de desenvolvimento
|
|
367
|
-
composer require --dev phpunit/phpunit
|
|
368
|
-
|
|
369
|
-
# Atualizar todas as dependências
|
|
370
|
-
composer update
|
|
371
|
-
|
|
372
|
-
# Instalar apenas dependências de produção
|
|
373
|
-
composer install --no-dev --optimize-autoloader
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### **Estrutura de Plugins Recomendada**
|
|
377
|
-
|
|
378
|
-
```
|
|
379
|
-
dist/wp-content/
|
|
380
|
-
├── 📂 plugins/ # Plugins via Composer
|
|
381
|
-
│ ├── 📂 advanced-custom-fields-pro/
|
|
382
|
-
│ ├── 📂 contact-form-7/
|
|
383
|
-
│ └── 📂 wp-rocket/
|
|
384
|
-
├── 📂 mu-plugins/ # Must-use plugins (custom)
|
|
385
|
-
│ ├── 📄 {{projectName}}-core.php # Core functionality
|
|
386
|
-
│ ├── 📄 {{projectName}}-security.php # Security enhancements
|
|
387
|
-
│ └── 📄 {{projectName}}-performance.php # Performance optimizations
|
|
388
|
-
└── 📂 themes/{{projectThemeSlug}}/
|
|
389
|
-
└── 📂 vendor/ # Autoloaded classes
|
|
390
|
-
└── 📂 composer/
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
## 🏷️ **Versionamento e Releases**
|
|
394
|
-
|
|
395
|
-
### **Semantic Versioning (SemVer)**
|
|
396
|
-
|
|
397
|
-
Seguimos o padrão **SemVer**: `MAJOR.MINOR.PATCH`
|
|
398
|
-
|
|
399
|
-
```
|
|
400
|
-
v1.2.3
|
|
401
|
-
│ │ │
|
|
402
|
-
│ │ └── PATCH: Bug fixes, hotfixes
|
|
403
|
-
│ └──── MINOR: New features, backward compatible
|
|
404
|
-
└────── MAJOR: Breaking changes, major updates
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
### **Versionamento do WordPress Core**
|
|
408
|
-
|
|
409
|
-
```bash
|
|
410
|
-
# Arquivo: dist/wp-content/themes/{{projectThemeSlug}}/style.css
|
|
411
|
-
/*
|
|
412
|
-
Theme Name: {{projectTitle}} Theme
|
|
413
|
-
Description: Custom WordPress theme for {{projectTitle}} website
|
|
414
|
-
Version: 1.2.3
|
|
415
|
-
Author: {{projectTitle}} Dev Team
|
|
416
|
-
*/
|
|
417
|
-
|
|
418
|
-
# Arquivo: dist/wp-content/themes/{{projectThemeSlug}}/functions.php
|
|
419
|
-
define('{{projectConstant}}_THEME_VERSION', '1.2.3');
|
|
420
|
-
|
|
421
|
-
# Uso no tema
|
|
422
|
-
wp_enqueue_style('{{projectName}}-main', get_theme_file_uri('assets/css/main.css'), [], {{projectConstant}}_THEME_VERSION);
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
### **Automatização de Releases**
|
|
426
|
-
|
|
427
|
-
```yaml
|
|
428
|
-
# .gitlab-ci.yml - Job de Release
|
|
429
|
-
create_release:
|
|
430
|
-
stage: release
|
|
431
|
-
script:
|
|
432
|
-
- echo "Creating release v${CI_COMMIT_TAG}"
|
|
433
|
-
- |
|
|
434
|
-
# Atualizar version no style.css
|
|
435
|
-
sed -i "s/Version: .*/Version: ${CI_COMMIT_TAG#v}/" dist/wp-content/themes/{{projectThemeSlug}}/style.css
|
|
436
|
-
|
|
437
|
-
# Atualizar version no functions.php
|
|
438
|
-
sed -i "s/{{projectConstant}}_THEME_VERSION', '.*'/{{projectConstant}}_THEME_VERSION', '${CI_COMMIT_TAG#v}'/" dist/wp-content/themes/{{projectThemeSlug}}/functions.php
|
|
439
|
-
|
|
440
|
-
# Commit das mudanças
|
|
441
|
-
git add .
|
|
442
|
-
git commit -m "chore: bump version to ${CI_COMMIT_TAG}"
|
|
443
|
-
git push origin HEAD:master
|
|
444
|
-
|
|
445
|
-
- echo "Release ${CI_COMMIT_TAG} created successfully"
|
|
446
|
-
only:
|
|
447
|
-
- tags
|
|
448
|
-
when: manual
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
### **CHANGELOG.md Structure**
|
|
452
|
-
|
|
453
|
-
```markdown
|
|
454
|
-
# Changelog
|
|
455
|
-
|
|
456
|
-
All notable changes to this project will be documented in this file.
|
|
457
|
-
|
|
458
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
459
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
460
|
-
|
|
461
|
-
## [Unreleased]
|
|
462
|
-
|
|
463
|
-
### Added
|
|
464
|
-
|
|
465
|
-
- New feature in development
|
|
466
|
-
|
|
467
|
-
### Changed
|
|
468
|
-
|
|
469
|
-
- Improved existing functionality
|
|
470
|
-
|
|
471
|
-
### Fixed
|
|
472
|
-
|
|
473
|
-
- Bug fixes
|
|
474
|
-
|
|
475
|
-
## [1.2.3] - 2025-06-05
|
|
476
|
-
|
|
477
|
-
### Added
|
|
478
|
-
|
|
479
|
-
- User profile avatar upload functionality
|
|
480
|
-
- Enhanced security measures for file uploads
|
|
481
|
-
- New Gutenberg block for testimonials
|
|
482
|
-
|
|
483
|
-
### Changed
|
|
484
|
-
|
|
485
|
-
- Improved performance of image loading
|
|
486
|
-
- Updated WordPress core to latest version
|
|
487
|
-
- Refactored authentication system
|
|
488
|
-
|
|
489
|
-
### Fixed
|
|
490
|
-
|
|
491
|
-
- Fixed responsive header issue on mobile devices
|
|
492
|
-
- Resolved caching issue with dynamic content
|
|
493
|
-
- Fixed accessibility issues in navigation
|
|
494
|
-
|
|
495
|
-
### Security
|
|
496
|
-
|
|
497
|
-
- Patched XSS vulnerability in contact form
|
|
498
|
-
- Updated dependencies with security fixes
|
|
499
|
-
|
|
500
|
-
## [1.2.2] - 2025-05-23
|
|
501
|
-
|
|
502
|
-
...
|
|
48
|
+
D -- Yes --> F[Merge to development]
|
|
49
|
+
F --> G[Auto-deploy to {{projectDevDomain}}]
|
|
50
|
+
G --> H[QA on dev]
|
|
51
|
+
H --> I[{{prTermShort}} development -> staging]
|
|
52
|
+
I --> J[Merge to staging]
|
|
53
|
+
J --> K[Auto-deploy to {{projectStagingDomain}}]
|
|
54
|
+
K --> L[Final validation]
|
|
55
|
+
L --> M[{{prTermShort}} staging -> main]
|
|
56
|
+
M --> N[Merge to main]
|
|
57
|
+
N --> O[Auto-deploy to {{projectProductionDomain}}]
|
|
503
58
|
```
|
|
504
59
|
|
|
505
|
-
|
|
60
|
+
Direct pushes to `main`, `staging`, and `development` should be blocked
|
|
61
|
+
by branch protection — every change goes through a {{prTermShort}}.
|
|
506
62
|
|
|
507
|
-
|
|
63
|
+
## Commits
|
|
508
64
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
private $userRepository;
|
|
65
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/).
|
|
66
|
+
Husky + commitlint enforce the format locally; CI re-checks on every
|
|
67
|
+
{{prTermShort}}.
|
|
513
68
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
69
|
+
```text
|
|
70
|
+
<type>(<scope>): <subject>
|
|
517
71
|
|
|
518
|
-
|
|
519
|
-
// implementation
|
|
520
|
-
}
|
|
521
|
-
}
|
|
72
|
+
<body>
|
|
522
73
|
|
|
523
|
-
|
|
524
|
-
class GerenciadorPerfilUsuario {
|
|
525
|
-
private $repositorioUsuario;
|
|
526
|
-
|
|
527
|
-
public function atualizarAvatarUsuario($idUsuario, $dadosAvatar) {
|
|
528
|
-
// implementation
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
### **Padrões de Naming Convention**
|
|
534
|
-
|
|
535
|
-
```php
|
|
536
|
-
// Classes: PascalCase
|
|
537
|
-
class PaymentProcessor {}
|
|
538
|
-
class UserAuthenticationService {}
|
|
539
|
-
|
|
540
|
-
// Methods/Functions: camelCase
|
|
541
|
-
public function processPayment() {}
|
|
542
|
-
private function validateCreditCard() {}
|
|
543
|
-
|
|
544
|
-
// Variables: camelCase
|
|
545
|
-
$userName = 'john_doe';
|
|
546
|
-
$isUserLoggedIn = true;
|
|
547
|
-
$paymentGatewayConfig = [];
|
|
548
|
-
|
|
549
|
-
// Constants: UPPER_SNAKE_CASE
|
|
550
|
-
define('MAX_UPLOAD_SIZE', 5242880);
|
|
551
|
-
const API_BASE_URL = 'https://api.{{projectName}}.com';
|
|
552
|
-
|
|
553
|
-
// Files: kebab-case
|
|
554
|
-
user-profile-manager.php
|
|
555
|
-
payment-gateway-config.php
|
|
556
|
-
|
|
557
|
-
// CSS Classes: BEM Methodology
|
|
558
|
-
.user-profile {}
|
|
559
|
-
.user-profile__avatar {}
|
|
560
|
-
.user-profile__avatar--large {}
|
|
561
|
-
.user-profile__info {}
|
|
562
|
-
.user-profile__info--highlighted {}
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
### **BEM (Block Element Modifier) CSS**
|
|
566
|
-
|
|
567
|
-
```scss
|
|
568
|
-
// Block: componente independente
|
|
569
|
-
.hero-section {
|
|
570
|
-
padding: 2rem;
|
|
571
|
-
background: #fff;
|
|
572
|
-
|
|
573
|
-
// Element: parte do block
|
|
574
|
-
&__title {
|
|
575
|
-
font-size: 2.5rem;
|
|
576
|
-
font-weight: bold;
|
|
577
|
-
color: #333;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
&__subtitle {
|
|
581
|
-
font-size: 1.2rem;
|
|
582
|
-
color: #666;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
&__button {
|
|
586
|
-
padding: 1rem 2rem;
|
|
587
|
-
background: #007cba;
|
|
588
|
-
color: white;
|
|
589
|
-
border: none;
|
|
590
|
-
|
|
591
|
-
// Modifier: variação do element
|
|
592
|
-
&--large {
|
|
593
|
-
padding: 1.5rem 3rem;
|
|
594
|
-
font-size: 1.2rem;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
&--secondary {
|
|
598
|
-
background: #666;
|
|
599
|
-
color: white;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
// Modifier: variação do block
|
|
604
|
-
&--dark-theme {
|
|
605
|
-
background: #333;
|
|
606
|
-
color: white;
|
|
607
|
-
|
|
608
|
-
.hero-section__title {
|
|
609
|
-
color: white;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
```
|
|
614
|
-
|
|
615
|
-
### **DRY (Don't Repeat Yourself) Principles**
|
|
616
|
-
|
|
617
|
-
```php
|
|
618
|
-
// ❌ Código repetitivo
|
|
619
|
-
class UserController {
|
|
620
|
-
public function updateProfile($userId, $data) {
|
|
621
|
-
$user = get_user_by('ID', $userId);
|
|
622
|
-
if (!$user) {
|
|
623
|
-
wp_send_json_error('User not found', 404);
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
if (!current_user_can('edit_user', $userId)) {
|
|
628
|
-
wp_send_json_error('Insufficient permissions', 403);
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// Update logic
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
public function deleteProfile($userId) {
|
|
636
|
-
$user = get_user_by('ID', $userId);
|
|
637
|
-
if (!$user) {
|
|
638
|
-
wp_send_json_error('User not found', 404);
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
if (!current_user_can('delete_user', $userId)) {
|
|
643
|
-
wp_send_json_error('Insufficient permissions', 403);
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
// Delete logic
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// ✅ Aplicando DRY
|
|
652
|
-
class UserController {
|
|
653
|
-
private function validateUserAccess($userId, $capability) {
|
|
654
|
-
$user = get_user_by('ID', $userId);
|
|
655
|
-
if (!$user) {
|
|
656
|
-
wp_send_json_error('User not found', 404);
|
|
657
|
-
return false;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
if (!current_user_can($capability, $userId)) {
|
|
661
|
-
wp_send_json_error('Insufficient permissions', 403);
|
|
662
|
-
return false;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
return $user;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
public function updateProfile($userId, $data) {
|
|
669
|
-
$user = $this->validateUserAccess($userId, 'edit_user');
|
|
670
|
-
if (!$user) return;
|
|
671
|
-
|
|
672
|
-
// Update logic
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
public function deleteProfile($userId) {
|
|
676
|
-
$user = $this->validateUserAccess($userId, 'delete_user');
|
|
677
|
-
if (!$user) return;
|
|
678
|
-
|
|
679
|
-
// Delete logic
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
```
|
|
683
|
-
|
|
684
|
-
## 🏗️ **Arquitetura de Código (Padrões Laravel)**
|
|
685
|
-
|
|
686
|
-
### **Service Layer Pattern**
|
|
687
|
-
|
|
688
|
-
```php
|
|
689
|
-
// app/Services/UserService.php
|
|
690
|
-
namespace {{projectPascal}}\Services;
|
|
691
|
-
|
|
692
|
-
class UserService {
|
|
693
|
-
private $userRepository;
|
|
694
|
-
private $emailService;
|
|
695
|
-
|
|
696
|
-
public function __construct(UserRepository $userRepository, EmailService $emailService) {
|
|
697
|
-
$this->userRepository = $userRepository;
|
|
698
|
-
$this->emailService = $emailService;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
public function createUser(array $userData): User {
|
|
702
|
-
$this->validateUserData($userData);
|
|
703
|
-
|
|
704
|
-
$user = $this->userRepository->create($userData);
|
|
705
|
-
$this->emailService->sendWelcomeEmail($user);
|
|
706
|
-
|
|
707
|
-
return $user;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
private function validateUserData(array $data): void {
|
|
711
|
-
if (empty($data['email'])) {
|
|
712
|
-
throw new InvalidArgumentException('Email is required');
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
|
|
716
|
-
throw new InvalidArgumentException('Invalid email format');
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
### **Repository Pattern**
|
|
723
|
-
|
|
724
|
-
```php
|
|
725
|
-
// app/Repositories/UserRepository.php
|
|
726
|
-
namespace {{projectPascal}}\Repositories;
|
|
727
|
-
|
|
728
|
-
interface UserRepositoryInterface {
|
|
729
|
-
public function find(int $id): ?User;
|
|
730
|
-
public function create(array $data): User;
|
|
731
|
-
public function update(int $id, array $data): User;
|
|
732
|
-
public function delete(int $id): bool;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
class UserRepository implements UserRepositoryInterface {
|
|
736
|
-
public function find(int $id): ?User {
|
|
737
|
-
$userData = get_user_by('ID', $id);
|
|
738
|
-
return $userData ? new User($userData) : null;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
public function create(array $data): User {
|
|
742
|
-
$userId = wp_insert_user($data);
|
|
743
|
-
|
|
744
|
-
if (is_wp_error($userId)) {
|
|
745
|
-
throw new Exception('Failed to create user: ' . $userId->get_error_message());
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
return $this->find($userId);
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
public function update(int $id, array $data): User {
|
|
752
|
-
$data['ID'] = $id;
|
|
753
|
-
$result = wp_update_user($data);
|
|
754
|
-
|
|
755
|
-
if (is_wp_error($result)) {
|
|
756
|
-
throw new Exception('Failed to update user: ' . $result->get_error_message());
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
return $this->find($id);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
public function delete(int $id): bool {
|
|
763
|
-
return wp_delete_user($id);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
### **Model Layer**
|
|
769
|
-
|
|
770
|
-
```php
|
|
771
|
-
// app/Models/User.php
|
|
772
|
-
namespace {{projectPascal}}\Models;
|
|
773
|
-
|
|
774
|
-
class User {
|
|
775
|
-
private $id;
|
|
776
|
-
private $email;
|
|
777
|
-
private $firstName;
|
|
778
|
-
private $lastName;
|
|
779
|
-
private $avatar;
|
|
780
|
-
|
|
781
|
-
public function __construct($userData) {
|
|
782
|
-
$this->id = $userData->ID;
|
|
783
|
-
$this->email = $userData->user_email;
|
|
784
|
-
$this->firstName = $userData->first_name;
|
|
785
|
-
$this->lastName = $userData->last_name;
|
|
786
|
-
$this->avatar = get_user_meta($userData->ID, 'avatar', true);
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
public function getId(): int {
|
|
790
|
-
return $this->id;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
public function getEmail(): string {
|
|
794
|
-
return $this->email;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
public function getFullName(): string {
|
|
798
|
-
return trim($this->firstName . ' ' . $this->lastName);
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
public function getAvatar(): ?string {
|
|
802
|
-
return $this->avatar;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
public function toArray(): array {
|
|
806
|
-
return [
|
|
807
|
-
'id' => $this->id,
|
|
808
|
-
'email' => $this->email,
|
|
809
|
-
'first_name' => $this->firstName,
|
|
810
|
-
'last_name' => $this->lastName,
|
|
811
|
-
'full_name' => $this->getFullName(),
|
|
812
|
-
'avatar' => $this->avatar
|
|
813
|
-
];
|
|
814
|
-
}
|
|
815
|
-
}
|
|
74
|
+
<footer>
|
|
816
75
|
```
|
|
817
76
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
### **PHP CodeSniffer (PHPCS)**
|
|
821
|
-
|
|
822
|
-
```bash
|
|
823
|
-
# Instalar dependências de desenvolvimento
|
|
824
|
-
composer require --dev squizlabs/php_codesniffer
|
|
825
|
-
composer require --dev wp-coding-standards/wpcs
|
|
826
|
-
|
|
827
|
-
# Configurar padrões WordPress
|
|
828
|
-
./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
|
|
829
|
-
|
|
830
|
-
# Verificar código
|
|
831
|
-
./vendor/bin/phpcs --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/
|
|
832
|
-
|
|
833
|
-
# Corrigir automaticamente (quando possível)
|
|
834
|
-
./vendor/bin/phpcbf --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/
|
|
835
|
-
```
|
|
836
|
-
|
|
837
|
-
### **Configuração PHPCS**
|
|
838
|
-
|
|
839
|
-
```xml
|
|
840
|
-
<!-- phpcs.xml -->
|
|
841
|
-
<?xml version="1.0"?>
|
|
842
|
-
<ruleset name="{{projectTitle}} WordPress Coding Standards">
|
|
843
|
-
<description>{{projectTitle}} WordPress coding standards</description>
|
|
844
|
-
|
|
845
|
-
<!-- Include WordPress-Core standards -->
|
|
846
|
-
<rule ref="WordPress-Core">
|
|
847
|
-
<!-- Exclude filename rules -->
|
|
848
|
-
<exclude name="WordPress.Files.FileName"/>
|
|
849
|
-
</rule>
|
|
850
|
-
|
|
851
|
-
<!-- Include WordPress-Extra standards -->
|
|
852
|
-
<rule ref="WordPress-Extra">
|
|
853
|
-
<!-- Allow short array syntax -->
|
|
854
|
-
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
|
|
855
|
-
</rule>
|
|
856
|
-
|
|
857
|
-
<!-- Include WordPress-Docs standards -->
|
|
858
|
-
<rule ref="WordPress-Docs"/>
|
|
859
|
-
|
|
860
|
-
<!-- Check only PHP files -->
|
|
861
|
-
<arg name="extensions" value="php"/>
|
|
862
|
-
|
|
863
|
-
<!-- Show colors in output -->
|
|
864
|
-
<arg name="colors"/>
|
|
865
|
-
|
|
866
|
-
<!-- Show progress -->
|
|
867
|
-
<arg value="p"/>
|
|
77
|
+
Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`,
|
|
78
|
+
`test`, `chore`, `ci`, `build`, `revert`.
|
|
868
79
|
|
|
869
|
-
|
|
870
|
-
<file>dist/wp-content/themes/{{projectThemeSlug}}/</file>
|
|
871
|
-
<file>dist/wp-content/mu-plugins/</file>
|
|
80
|
+
Examples:
|
|
872
81
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
</ruleset>
|
|
82
|
+
```text
|
|
83
|
+
feat(checkout): support PIX payment method
|
|
84
|
+
fix(header): align logo on small viewports
|
|
85
|
+
chore(deps): bump roots/acorn to 6.2
|
|
878
86
|
```
|
|
879
87
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
```php
|
|
883
|
-
// tests/Unit/UserServiceTest.php
|
|
884
|
-
namespace Tests\Unit;
|
|
885
|
-
|
|
886
|
-
use PHPUnit\Framework\TestCase;
|
|
887
|
-
use {{projectPascal}}\Services\UserService;
|
|
888
|
-
use {{projectPascal}}\Repositories\UserRepository;
|
|
889
|
-
use {{projectPascal}}\Services\EmailService;
|
|
890
|
-
|
|
891
|
-
class UserServiceTest extends TestCase {
|
|
892
|
-
private $userService;
|
|
893
|
-
private $userRepository;
|
|
894
|
-
private $emailService;
|
|
895
|
-
|
|
896
|
-
protected function setUp(): void {
|
|
897
|
-
$this->userRepository = $this->createMock(UserRepository::class);
|
|
898
|
-
$this->emailService = $this->createMock(EmailService::class);
|
|
899
|
-
$this->userService = new UserService($this->userRepository, $this->emailService);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
public function testCreateUserWithValidData(): void {
|
|
903
|
-
$userData = [
|
|
904
|
-
'email' => 'test@example.com',
|
|
905
|
-
'first_name' => 'John',
|
|
906
|
-
'last_name' => 'Doe'
|
|
907
|
-
];
|
|
908
|
-
|
|
909
|
-
$expectedUser = new User((object) array_merge($userData, ['ID' => 1]));
|
|
910
|
-
|
|
911
|
-
$this->userRepository
|
|
912
|
-
->expects($this->once())
|
|
913
|
-
->method('create')
|
|
914
|
-
->with($userData)
|
|
915
|
-
->willReturn($expectedUser);
|
|
916
|
-
|
|
917
|
-
$this->emailService
|
|
918
|
-
->expects($this->once())
|
|
919
|
-
->method('sendWelcomeEmail')
|
|
920
|
-
->with($expectedUser);
|
|
921
|
-
|
|
922
|
-
$result = $this->userService->createUser($userData);
|
|
923
|
-
|
|
924
|
-
$this->assertInstanceOf(User::class, $result);
|
|
925
|
-
$this->assertEquals('test@example.com', $result->getEmail());
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
public function testCreateUserWithInvalidEmailThrowsException(): void {
|
|
929
|
-
$this->expectException(InvalidArgumentException::class);
|
|
930
|
-
$this->expectExceptionMessage('Invalid email format');
|
|
931
|
-
|
|
932
|
-
$userData = [
|
|
933
|
-
'email' => 'invalid-email',
|
|
934
|
-
'first_name' => 'John',
|
|
935
|
-
'last_name' => 'Doe'
|
|
936
|
-
];
|
|
937
|
-
|
|
938
|
-
$this->userService->createUser($userData);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
```
|
|
942
|
-
|
|
943
|
-
## 📋 **Code Review Guidelines**
|
|
944
|
-
|
|
945
|
-
### **Checklist de Code Review**
|
|
88
|
+
## Code review checklist
|
|
946
89
|
|
|
947
|
-
|
|
948
|
-
|
|
90
|
+
- [ ] The {{prTermShort}} description explains *why*, not just *what*.
|
|
91
|
+
- [ ] CI is green (lint, tests, build).
|
|
92
|
+
- [ ] No secrets in code or commit history.
|
|
93
|
+
- [ ] Documentation updated when behaviour changes.
|
|
94
|
+
- [ ] Migration / data-fix steps documented for ops.
|
|
95
|
+
- [ ] Screenshots attached for UI changes.
|
|
949
96
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
- [ ] Code implements requirements correctly
|
|
953
|
-
- [ ] Edge cases are handled appropriately
|
|
954
|
-
- [ ] Error handling is implemented
|
|
955
|
-
- [ ] Performance considerations are addressed
|
|
956
|
-
|
|
957
|
-
### ✅ Code Quality
|
|
958
|
-
|
|
959
|
-
- [ ] Code follows DRY principles
|
|
960
|
-
- [ ] Functions are single-responsibility
|
|
961
|
-
- [ ] Variable and function names are descriptive (in English)
|
|
962
|
-
- [ ] Code is readable and well-structured
|
|
963
|
-
|
|
964
|
-
### ✅ Standards Compliance
|
|
965
|
-
|
|
966
|
-
- [ ] Follows WordPress coding standards
|
|
967
|
-
- [ ] BEM methodology for CSS
|
|
968
|
-
- [ ] PSR-12 compliance for PHP
|
|
969
|
-
- [ ] Semantic versioning for releases
|
|
970
|
-
|
|
971
|
-
### ✅ Security
|
|
972
|
-
|
|
973
|
-
- [ ] Input validation is implemented
|
|
974
|
-
- [ ] SQL injection prevention
|
|
975
|
-
- [ ] XSS prevention
|
|
976
|
-
- [ ] CSRF protection where needed
|
|
977
|
-
|
|
978
|
-
### ✅ Testing
|
|
979
|
-
|
|
980
|
-
- [ ] Unit tests are included
|
|
981
|
-
- [ ] Test coverage is adequate
|
|
982
|
-
- [ ] Integration tests pass
|
|
983
|
-
- [ ] Manual testing completed
|
|
984
|
-
|
|
985
|
-
### ✅ Documentation
|
|
986
|
-
|
|
987
|
-
- [ ] Code is properly documented
|
|
988
|
-
- [ ] README updated if needed
|
|
989
|
-
- [ ] CHANGELOG updated for user-facing changes
|
|
990
|
-
- [ ] API documentation updated
|
|
991
|
-
|
|
992
|
-
### ✅ Merge Request Process
|
|
993
|
-
|
|
994
|
-
- [ ] MR template properly filled
|
|
995
|
-
- [ ] Target branch is correct
|
|
996
|
-
- [ ] Required approvals obtained
|
|
997
|
-
- [ ] CI/CD pipeline passes
|
|
998
|
-
```
|
|
999
|
-
|
|
1000
|
-
### **Commit Message Standards**
|
|
97
|
+
## Lint and formatting
|
|
1001
98
|
|
|
1002
99
|
```bash
|
|
1003
|
-
#
|
|
1004
|
-
#
|
|
1005
|
-
#
|
|
1006
|
-
#
|
|
1007
|
-
|
|
1008
|
-
# docs: documentação
|
|
1009
|
-
# style: formatação, missing semi colons, etc
|
|
1010
|
-
# refactor: refatoração de código
|
|
1011
|
-
# test: adição de testes
|
|
1012
|
-
# chore: manutenção
|
|
1013
|
-
|
|
1014
|
-
# ✅ Exemplos corretos
|
|
1015
|
-
feat(user): add avatar upload functionality
|
|
1016
|
-
fix(header): resolve responsive navigation issue
|
|
1017
|
-
docs(api): update authentication endpoints
|
|
1018
|
-
style(css): format according to BEM methodology
|
|
1019
|
-
refactor(auth): extract user validation logic
|
|
1020
|
-
test(user): add unit tests for user service
|
|
1021
|
-
chore(deps): update composer dependencies
|
|
1022
|
-
|
|
1023
|
-
# ❌ Exemplos incorretos
|
|
1024
|
-
added new feature
|
|
1025
|
-
fix bug
|
|
1026
|
-
update code
|
|
1027
|
-
changes
|
|
1028
|
-
```
|
|
1029
|
-
|
|
1030
|
-
## 🎯 **Performance e Otimização**
|
|
1031
|
-
|
|
1032
|
-
### **WordPress Performance Best Practices**
|
|
1033
|
-
|
|
1034
|
-
```php
|
|
1035
|
-
// ✅ Efficient database queries
|
|
1036
|
-
$posts = new WP_Query([
|
|
1037
|
-
'post_type' => 'product',
|
|
1038
|
-
'posts_per_page' => 10,
|
|
1039
|
-
'meta_query' => [
|
|
1040
|
-
[
|
|
1041
|
-
'key' => 'featured',
|
|
1042
|
-
'value' => 'yes',
|
|
1043
|
-
'compare' => '='
|
|
1044
|
-
]
|
|
1045
|
-
],
|
|
1046
|
-
'no_found_rows' => true, // Skip pagination count
|
|
1047
|
-
'update_post_meta_cache' => false, // Skip meta cache if not needed
|
|
1048
|
-
'update_post_term_cache' => false // Skip term cache if not needed
|
|
1049
|
-
]);
|
|
1050
|
-
|
|
1051
|
-
// ✅ Proper asset enqueuing with versioning
|
|
1052
|
-
wp_enqueue_script(
|
|
1053
|
-
'{{projectName}}-main',
|
|
1054
|
-
get_theme_file_uri('assets/js/main.js'),
|
|
1055
|
-
['jquery'],
|
|
1056
|
-
{{projectConstant}}_THEME_VERSION,
|
|
1057
|
-
true
|
|
1058
|
-
);
|
|
1059
|
-
|
|
1060
|
-
// ✅ Conditional loading
|
|
1061
|
-
if (is_front_page()) {
|
|
1062
|
-
wp_enqueue_script('hero-slider', get_theme_file_uri('assets/js/hero-slider.js'));
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
// ✅ Efficient image handling
|
|
1066
|
-
function {{projectSnake}}_get_responsive_image($attachment_id, $sizes = 'full') {
|
|
1067
|
-
return wp_get_attachment_image(
|
|
1068
|
-
$attachment_id,
|
|
1069
|
-
$sizes,
|
|
1070
|
-
false,
|
|
1071
|
-
[
|
|
1072
|
-
'loading' => 'lazy',
|
|
1073
|
-
'decoding' => 'async'
|
|
1074
|
-
]
|
|
1075
|
-
);
|
|
1076
|
-
}
|
|
100
|
+
npm run lint # ESLint + Stylelint
|
|
101
|
+
npm run lint:fix # Auto-fix where possible
|
|
102
|
+
npm run format # Prettier
|
|
103
|
+
{{#if useSage}}composer lint --working-dir=content/themes/{{projectName}} # Pint
|
|
104
|
+
composer lint:fix --working-dir=content/themes/{{projectName}}{{/if}}
|
|
1077
105
|
```
|
|
1078
106
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
```scss
|
|
1082
|
-
// assets/scss/main.scss
|
|
1083
|
-
// Import order: Variables → Mixins → Base → Components → Pages
|
|
1084
|
-
|
|
1085
|
-
// 1. Variables and configuration
|
|
1086
|
-
@import 'config/variables';
|
|
1087
|
-
@import 'config/breakpoints';
|
|
1088
|
-
@import 'config/colors';
|
|
1089
|
-
|
|
1090
|
-
// 2. Mixins and utilities
|
|
1091
|
-
@import 'mixins/responsive';
|
|
1092
|
-
@import 'mixins/typography';
|
|
1093
|
-
@import 'utilities/helpers';
|
|
1094
|
-
|
|
1095
|
-
// 3. Base styles
|
|
1096
|
-
@import 'base/reset';
|
|
1097
|
-
@import 'base/typography';
|
|
1098
|
-
@import 'base/layout';
|
|
1099
|
-
|
|
1100
|
-
// 4. Components (BEM blocks)
|
|
1101
|
-
@import 'components/header';
|
|
1102
|
-
@import 'components/navigation';
|
|
1103
|
-
@import 'components/hero-section';
|
|
1104
|
-
@import 'components/card';
|
|
1105
|
-
@import 'components/button';
|
|
1106
|
-
|
|
1107
|
-
// 5. Page-specific styles
|
|
1108
|
-
@import 'pages/home';
|
|
1109
|
-
@import 'pages/about';
|
|
1110
|
-
@import 'pages/contact';
|
|
1111
|
-
|
|
1112
|
-
// 6. WordPress specific
|
|
1113
|
-
@import 'wordpress/gutenberg';
|
|
1114
|
-
@import 'wordpress/comments';
|
|
1115
|
-
@import 'wordpress/widgets';
|
|
1116
|
-
```
|
|
107
|
+
Husky runs lint-staged on every commit so only changed files are
|
|
108
|
+
checked; CI re-runs the full sweep.
|
|
1117
109
|
|
|
1118
|
-
##
|
|
110
|
+
## Tests
|
|
1119
111
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
112
|
+
- **PHP**: `{{ "{{TODO: Pest suite location and how to invoke it}}" }}`
|
|
113
|
+
- **E2E**: Playwright specs under `tests/e2e/`. Run locally with
|
|
114
|
+
`npm run test:e2e`.
|
|
115
|
+
- **Visual regression**: `{{ "{{TODO: define if/how visual regression is captured}}" }}`
|
|
1123
116
|
|
|
1124
|
-
##
|
|
117
|
+
## Releases
|
|
1125
118
|
|
|
1126
|
-
|
|
1127
|
-
- **Standards Issues**: [GitLab Issues - Label: code-quality]({{repositoryWebUrl}}/-/issues?label_name=code-quality)
|
|
1128
|
-
- **Development Discussion**: Slack #dev-website
|
|
1129
|
-
- **Merge Request Help**: [GitLab MR Guidelines](https://docs.gitlab.com/ee/user/project/merge_requests/)
|
|
119
|
+
Releases are tag-driven. The recommended flow:
|
|
1130
120
|
|
|
1131
|
-
|
|
121
|
+
1. Open a `release/vX.Y.Z` branch off `main`.
|
|
122
|
+
2. Bump the version in `package.json` and the project changelog.
|
|
123
|
+
3. {{prTermShort}} `release/vX.Y.Z` → `staging`; validate.
|
|
124
|
+
4. {{prTermShort}} `staging` → `main`; tag `vX.Y.Z` on the merge commit.
|
|
125
|
+
5. {{ciSystem}} deploys the tag to {{projectProductionDomain}}.
|
|
1132
126
|
|
|
1133
|
-
|
|
1134
|
-
🌊 **Workflow**: GitFlow modificado (branches from master)
|
|
1135
|
-
🏷️ **Versionamento**: Semantic Versioning (SemVer)
|
|
1136
|
-
📦 **Dependencies**: Composer-based plugin management
|
|
1137
|
-
🧪 **Quality**: PHPCS + Unit Tests + Code Review
|
|
1138
|
-
🎨 **Standards**: BEM + DRY + Laravel-inspired architecture
|
|
1139
|
-
✅ **Process**: **Merge Requests obrigatórios para staging/master**
|
|
127
|
+
`{{ "{{TODO: replace this section if the project adopts release-please / semantic-release}}" }}`
|