@codigodoleo/wp-kit 3.5.0 → 4.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/lib/prompts/index.js +99 -0
- package/modules/docs/index.js +15 -0
- package/modules/docs/templates/README.md.hbs +32 -32
- package/modules/docs/templates/docs/{Arquitetura.md → Arquitetura.md.hbs} +27 -27
- package/modules/docs/templates/docs/{Deploy-Pipeline.md → Deploy-Pipeline.md.hbs} +6 -6
- package/modules/docs/templates/docs/{Desenvolvimento.md → Desenvolvimento.md.hbs} +39 -39
- package/modules/docs/templates/docs/{Getting-Started.md → Getting-Started.md.hbs} +35 -35
- package/modules/docs/templates/docs/{Infraestrutura.md → Infraestrutura.md.hbs} +1 -1
- package/modules/docs/templates/docs/{Monitoramento.md → Monitoramento.md.hbs} +1 -1
- package/modules/docs/templates/docs/{Sync-the-Production-DB-with-the-Staging-DB.md → Sync-the-Production-DB-with-the-Staging-DB.md.hbs} +1 -1
- package/modules/docs/templates/docs/Troubleshooting.md.hbs +3 -0
- package/modules/mu-plugin/index.js +143 -17
- package/modules/mu-plugin/prompts.js +7 -0
- package/modules/mu-plugin/templates/acorn/.gitignore.hbs +10 -0
- package/modules/mu-plugin/templates/acorn/README.md.hbs +46 -0
- package/modules/mu-plugin/templates/acorn/app/Providers/CoreServiceProvider.php.hbs +26 -0
- package/modules/mu-plugin/templates/acorn/composer.json.hbs +31 -0
- package/modules/mu-plugin/templates/acorn/config/app.php.hbs +43 -0
- package/modules/mu-plugin/templates/acorn/config/logging.php.hbs +59 -0
- package/modules/mu-plugin/templates/acorn/plugin.php.hbs +95 -0
- package/modules/mu-plugin/templates/acorn/resources/.gitkeep +0 -0
- package/modules/mu-plugin/templates/acorn/storage/framework/cache/.gitkeep +0 -0
- package/modules/mu-plugin/templates/acorn/storage/framework/sessions/.gitkeep +0 -0
- package/modules/mu-plugin/templates/acorn/storage/framework/views/.gitkeep +0 -0
- package/modules/mu-plugin/templates/bedrock-autoloader.php +28 -0
- package/modules/sage/templates/.lando.yml.hbs +4 -1
- package/package.json +1 -1
- package/templates/.lando.yml.hbs +0 -9
- package/modules/docs/templates/docs/Troubleshooting.md +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 💻 Desenvolvimento
|
|
2
2
|
|
|
3
|
-
Guia completo de desenvolvimento para o projeto
|
|
3
|
+
Guia completo de desenvolvimento para o projeto {{projectTitle}} Website, com foco em qualidade, padrões e boas práticas profissionais.
|
|
4
4
|
|
|
5
5
|
## 🌊 **Git Workflow (GitFlow Modificado)**
|
|
6
6
|
|
|
@@ -97,17 +97,17 @@ graph TD
|
|
|
97
97
|
D -->|No| E[Address Feedback]
|
|
98
98
|
E --> C
|
|
99
99
|
D -->|Yes| F[✅ Merge to development via MR]
|
|
100
|
-
F --> G[Auto Deploy to
|
|
100
|
+
F --> G[Auto Deploy to {{projectDevDomain}}]
|
|
101
101
|
G --> H[QA Testing]
|
|
102
102
|
H --> I[✅ Create MR: development → staging]
|
|
103
103
|
I --> J[Code Review + Approval]
|
|
104
104
|
J --> K[✅ Merge to staging via MR]
|
|
105
|
-
K --> L[Deploy to
|
|
105
|
+
K --> L[Deploy to {{projectStagingDomain}}]
|
|
106
106
|
L --> M[Final Validation]
|
|
107
107
|
M --> N[✅ Create MR: staging → master]
|
|
108
108
|
N --> O[Final Code Review + Approval]
|
|
109
109
|
O --> P[✅ Merge to master via MR]
|
|
110
|
-
P --> Q[Deploy to
|
|
110
|
+
P --> Q[Deploy to {{projectProductionDomain}}]
|
|
111
111
|
|
|
112
112
|
style F fill:#1dd1a1
|
|
113
113
|
style K fill:#1dd1a1
|
|
@@ -301,8 +301,8 @@ git push origin feature/my-feature
|
|
|
301
301
|
|
|
302
302
|
```json
|
|
303
303
|
{
|
|
304
|
-
"name": "
|
|
305
|
-
"description": "
|
|
304
|
+
"name": "{{projectName}}/wordpress-website",
|
|
305
|
+
"description": "{{projectTitle}} WordPress Website",
|
|
306
306
|
"type": "project",
|
|
307
307
|
"require": {
|
|
308
308
|
"php": ">=8.0",
|
|
@@ -342,14 +342,14 @@ git push origin feature/my-feature
|
|
|
342
342
|
},
|
|
343
343
|
"autoload": {
|
|
344
344
|
"psr-4": {
|
|
345
|
-
"
|
|
345
|
+
"{{projectPascal}}\\": "dist/wp-content/themes/{{projectThemeSlug}}/inc/"
|
|
346
346
|
}
|
|
347
347
|
},
|
|
348
348
|
"scripts": {
|
|
349
349
|
"install-plugins": "composer install --no-dev",
|
|
350
350
|
"test": "phpunit",
|
|
351
|
-
"lint": "phpcs --standard=WordPress dist/wp-content/themes/
|
|
352
|
-
"format": "phpcbf --standard=WordPress dist/wp-content/themes/
|
|
351
|
+
"lint": "phpcs --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/",
|
|
352
|
+
"format": "phpcbf --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/"
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
```
|
|
@@ -382,10 +382,10 @@ dist/wp-content/
|
|
|
382
382
|
│ ├── 📂 contact-form-7/
|
|
383
383
|
│ └── 📂 wp-rocket/
|
|
384
384
|
├── 📂 mu-plugins/ # Must-use plugins (custom)
|
|
385
|
-
│ ├── 📄
|
|
386
|
-
│ ├── 📄
|
|
387
|
-
│ └── 📄
|
|
388
|
-
└── 📂 themes/
|
|
385
|
+
│ ├── 📄 {{projectName}}-core.php # Core functionality
|
|
386
|
+
│ ├── 📄 {{projectName}}-security.php # Security enhancements
|
|
387
|
+
│ └── 📄 {{projectName}}-performance.php # Performance optimizations
|
|
388
|
+
└── 📂 themes/{{projectThemeSlug}}/
|
|
389
389
|
└── 📂 vendor/ # Autoloaded classes
|
|
390
390
|
└── 📂 composer/
|
|
391
391
|
```
|
|
@@ -407,19 +407,19 @@ v1.2.3
|
|
|
407
407
|
### **Versionamento do WordPress Core**
|
|
408
408
|
|
|
409
409
|
```bash
|
|
410
|
-
# Arquivo: dist/wp-content/themes/
|
|
410
|
+
# Arquivo: dist/wp-content/themes/{{projectThemeSlug}}/style.css
|
|
411
411
|
/*
|
|
412
|
-
Theme Name:
|
|
413
|
-
Description: Custom WordPress theme for
|
|
412
|
+
Theme Name: {{projectTitle}} Theme
|
|
413
|
+
Description: Custom WordPress theme for {{projectTitle}} website
|
|
414
414
|
Version: 1.2.3
|
|
415
|
-
Author:
|
|
415
|
+
Author: {{projectTitle}} Dev Team
|
|
416
416
|
*/
|
|
417
417
|
|
|
418
|
-
# Arquivo: dist/wp-content/themes/
|
|
419
|
-
define('
|
|
418
|
+
# Arquivo: dist/wp-content/themes/{{projectThemeSlug}}/functions.php
|
|
419
|
+
define('{{projectConstant}}_THEME_VERSION', '1.2.3');
|
|
420
420
|
|
|
421
421
|
# Uso no tema
|
|
422
|
-
wp_enqueue_style('
|
|
422
|
+
wp_enqueue_style('{{projectName}}-main', get_theme_file_uri('assets/css/main.css'), [], {{projectConstant}}_THEME_VERSION);
|
|
423
423
|
```
|
|
424
424
|
|
|
425
425
|
### **Automatização de Releases**
|
|
@@ -432,10 +432,10 @@ create_release:
|
|
|
432
432
|
- echo "Creating release v${CI_COMMIT_TAG}"
|
|
433
433
|
- |
|
|
434
434
|
# Atualizar version no style.css
|
|
435
|
-
sed -i "s/Version: .*/Version: ${CI_COMMIT_TAG#v}/" dist/wp-content/themes/
|
|
435
|
+
sed -i "s/Version: .*/Version: ${CI_COMMIT_TAG#v}/" dist/wp-content/themes/{{projectThemeSlug}}/style.css
|
|
436
436
|
|
|
437
437
|
# Atualizar version no functions.php
|
|
438
|
-
sed -i "s/
|
|
438
|
+
sed -i "s/{{projectConstant}}_THEME_VERSION', '.*'/{{projectConstant}}_THEME_VERSION', '${CI_COMMIT_TAG#v}'/" dist/wp-content/themes/{{projectThemeSlug}}/functions.php
|
|
439
439
|
|
|
440
440
|
# Commit das mudanças
|
|
441
441
|
git add .
|
|
@@ -548,7 +548,7 @@ $paymentGatewayConfig = [];
|
|
|
548
548
|
|
|
549
549
|
// Constants: UPPER_SNAKE_CASE
|
|
550
550
|
define('MAX_UPLOAD_SIZE', 5242880);
|
|
551
|
-
const API_BASE_URL = 'https://api.
|
|
551
|
+
const API_BASE_URL = 'https://api.{{projectName}}.com';
|
|
552
552
|
|
|
553
553
|
// Files: kebab-case
|
|
554
554
|
user-profile-manager.php
|
|
@@ -687,7 +687,7 @@ class UserController {
|
|
|
687
687
|
|
|
688
688
|
```php
|
|
689
689
|
// app/Services/UserService.php
|
|
690
|
-
namespace
|
|
690
|
+
namespace {{projectPascal}}\Services;
|
|
691
691
|
|
|
692
692
|
class UserService {
|
|
693
693
|
private $userRepository;
|
|
@@ -723,7 +723,7 @@ class UserService {
|
|
|
723
723
|
|
|
724
724
|
```php
|
|
725
725
|
// app/Repositories/UserRepository.php
|
|
726
|
-
namespace
|
|
726
|
+
namespace {{projectPascal}}\Repositories;
|
|
727
727
|
|
|
728
728
|
interface UserRepositoryInterface {
|
|
729
729
|
public function find(int $id): ?User;
|
|
@@ -769,7 +769,7 @@ class UserRepository implements UserRepositoryInterface {
|
|
|
769
769
|
|
|
770
770
|
```php
|
|
771
771
|
// app/Models/User.php
|
|
772
|
-
namespace
|
|
772
|
+
namespace {{projectPascal}}\Models;
|
|
773
773
|
|
|
774
774
|
class User {
|
|
775
775
|
private $id;
|
|
@@ -828,10 +828,10 @@ composer require --dev wp-coding-standards/wpcs
|
|
|
828
828
|
./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
|
|
829
829
|
|
|
830
830
|
# Verificar código
|
|
831
|
-
./vendor/bin/phpcs --standard=WordPress dist/wp-content/themes/
|
|
831
|
+
./vendor/bin/phpcs --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/
|
|
832
832
|
|
|
833
833
|
# Corrigir automaticamente (quando possível)
|
|
834
|
-
./vendor/bin/phpcbf --standard=WordPress dist/wp-content/themes/
|
|
834
|
+
./vendor/bin/phpcbf --standard=WordPress dist/wp-content/themes/{{projectThemeSlug}}/
|
|
835
835
|
```
|
|
836
836
|
|
|
837
837
|
### **Configuração PHPCS**
|
|
@@ -839,8 +839,8 @@ composer require --dev wp-coding-standards/wpcs
|
|
|
839
839
|
```xml
|
|
840
840
|
<!-- phpcs.xml -->
|
|
841
841
|
<?xml version="1.0"?>
|
|
842
|
-
<ruleset name="
|
|
843
|
-
<description>
|
|
842
|
+
<ruleset name="{{projectTitle}} WordPress Coding Standards">
|
|
843
|
+
<description>{{projectTitle}} WordPress coding standards</description>
|
|
844
844
|
|
|
845
845
|
<!-- Include WordPress-Core standards -->
|
|
846
846
|
<rule ref="WordPress-Core">
|
|
@@ -867,7 +867,7 @@ composer require --dev wp-coding-standards/wpcs
|
|
|
867
867
|
<arg value="p"/>
|
|
868
868
|
|
|
869
869
|
<!-- Include paths -->
|
|
870
|
-
<file>dist/wp-content/themes/
|
|
870
|
+
<file>dist/wp-content/themes/{{projectThemeSlug}}/</file>
|
|
871
871
|
<file>dist/wp-content/mu-plugins/</file>
|
|
872
872
|
|
|
873
873
|
<!-- Exclude paths -->
|
|
@@ -884,9 +884,9 @@ composer require --dev wp-coding-standards/wpcs
|
|
|
884
884
|
namespace Tests\Unit;
|
|
885
885
|
|
|
886
886
|
use PHPUnit\Framework\TestCase;
|
|
887
|
-
use
|
|
888
|
-
use
|
|
889
|
-
use
|
|
887
|
+
use {{projectPascal}}\Services\UserService;
|
|
888
|
+
use {{projectPascal}}\Repositories\UserRepository;
|
|
889
|
+
use {{projectPascal}}\Services\EmailService;
|
|
890
890
|
|
|
891
891
|
class UserServiceTest extends TestCase {
|
|
892
892
|
private $userService;
|
|
@@ -1050,10 +1050,10 @@ $posts = new WP_Query([
|
|
|
1050
1050
|
|
|
1051
1051
|
// ✅ Proper asset enqueuing with versioning
|
|
1052
1052
|
wp_enqueue_script(
|
|
1053
|
-
'
|
|
1053
|
+
'{{projectName}}-main',
|
|
1054
1054
|
get_theme_file_uri('assets/js/main.js'),
|
|
1055
1055
|
['jquery'],
|
|
1056
|
-
|
|
1056
|
+
{{projectConstant}}_THEME_VERSION,
|
|
1057
1057
|
true
|
|
1058
1058
|
);
|
|
1059
1059
|
|
|
@@ -1063,7 +1063,7 @@ if (is_front_page()) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
1065
|
// ✅ Efficient image handling
|
|
1066
|
-
function
|
|
1066
|
+
function {{projectSnake}}_get_responsive_image($attachment_id, $sizes = 'full') {
|
|
1067
1067
|
return wp_get_attachment_image(
|
|
1068
1068
|
$attachment_id,
|
|
1069
1069
|
$sizes,
|
|
@@ -1123,8 +1123,8 @@ function pipefy_get_responsive_image($attachment_id, $sizes = 'full') {
|
|
|
1123
1123
|
|
|
1124
1124
|
## 📞 **Suporte ao Desenvolvimento**
|
|
1125
1125
|
|
|
1126
|
-
- **Code Review**: Equipe senior (ver [CODEOWNERS](
|
|
1127
|
-
- **Standards Issues**: [GitLab Issues - Label: code-quality](
|
|
1126
|
+
- **Code Review**: Equipe senior (ver [CODEOWNERS]({{repositoryWebUrl}}/-/blob/master/CODEOWNERS))
|
|
1127
|
+
- **Standards Issues**: [GitLab Issues - Label: code-quality]({{repositoryWebUrl}}/-/issues?label_name=code-quality)
|
|
1128
1128
|
- **Development Discussion**: Slack #dev-website
|
|
1129
1129
|
- **Merge Request Help**: [GitLab MR Guidelines](https://docs.gitlab.com/ee/user/project/merge_requests/)
|
|
1130
1130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🚀 Getting Started
|
|
2
2
|
|
|
3
|
-
Guia completo para configurar o ambiente de desenvolvimento local do site
|
|
3
|
+
Guia completo para configurar o ambiente de desenvolvimento local do site {{projectTitle}}.
|
|
4
4
|
|
|
5
5
|
## 📋 **Pré-requisitos**
|
|
6
6
|
|
|
@@ -31,12 +31,12 @@ git --version # Qualquer versão recente
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
# SSH (recomendado)
|
|
34
|
-
git clone
|
|
35
|
-
cd
|
|
34
|
+
git clone {{gitRepository}}
|
|
35
|
+
cd {{projectName}}
|
|
36
36
|
|
|
37
37
|
# HTTPS (alternativo)
|
|
38
|
-
git clone
|
|
39
|
-
cd
|
|
38
|
+
git clone {{repositoryHttpsUrl}}
|
|
39
|
+
cd {{projectName}}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### 2. **📥 Download do Banco de Dados (OBRIGATÓRIO)**
|
|
@@ -45,7 +45,7 @@ cd pipefy-website
|
|
|
45
45
|
|
|
46
46
|
#### No GitLab:
|
|
47
47
|
|
|
48
|
-
1. **Acesse**: [CI/CD → Schedules](
|
|
48
|
+
1. **Acesse**: [CI/CD → Schedules]({{repositoryWebUrl}}/-/pipeline_schedules)
|
|
49
49
|
2. **Execute**: Clique no botão ▶️ (play) no pipeline **"Download Prod Database"**
|
|
50
50
|
3. **Aguarde**: O pipeline executar completamente
|
|
51
51
|
4. **Acesse**: Recarregue a página (Ctrl+F5) e clique no **Pipeline ID** na coluna "Last Pipeline"
|
|
@@ -55,7 +55,7 @@ cd pipefy-website
|
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
# Estrutura esperada após download
|
|
58
|
-
|
|
58
|
+
{{projectName}}/
|
|
59
59
|
├── 📂 database/
|
|
60
60
|
│ └── 📄 production-dump-YYYY-MM-DD.sql # Arquivo baixado
|
|
61
61
|
├── 📄 .lando.yml
|
|
@@ -86,7 +86,7 @@ lando wp db check
|
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
# Usar nosso tooling para inicialização
|
|
89
|
-
lando init-wp --user=seu-email@
|
|
89
|
+
lando init-wp --user=seu-email@{{projectName}}.com
|
|
90
90
|
|
|
91
91
|
# Aguardar conclusão da configuração
|
|
92
92
|
```
|
|
@@ -95,7 +95,7 @@ lando init-wp --user=seu-email@pipefy.com
|
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
# Verificar se WordPress está funcionando
|
|
98
|
-
curl -I https://
|
|
98
|
+
curl -I https://{{projectDomain}}
|
|
99
99
|
|
|
100
100
|
# Deve retornar HTTP/2 200
|
|
101
101
|
|
|
@@ -117,7 +117,7 @@ lando wp post list --post_type=page --posts_per_page=5
|
|
|
117
117
|
lando db-import database/production-dump-NOVA-DATA.sql
|
|
118
118
|
|
|
119
119
|
# 3. Re-inicialização usando nosso tooling
|
|
120
|
-
lando init-wp --user=seu-email@
|
|
120
|
+
lando init-wp --user=seu-email@{{projectName}}.com
|
|
121
121
|
|
|
122
122
|
# 4. Verificação
|
|
123
123
|
lando wp post list --post_type=page --posts_per_page=5
|
|
@@ -134,10 +134,10 @@ lando wp post list --post_type=page --posts_per_page=5
|
|
|
134
134
|
|
|
135
135
|
| Serviço | URL | Credenciais |
|
|
136
136
|
| ------------------------- | ---------------------------------------------------------------------- | ------------------ |
|
|
137
|
-
| **Site Frontend** | [https://
|
|
138
|
-
| **WordPress Admin** | [https://
|
|
139
|
-
| **Database (phpMyAdmin)** | [https://
|
|
140
|
-
| **MailHog** | [https://
|
|
137
|
+
| **Site Frontend** | [https://{{projectDomain}}](https://{{projectDomain}}) | - |
|
|
138
|
+
| **WordPress Admin** | [https://{{projectDomain}}/wp-admin](https://{{projectDomain}}/wp-admin) | Definidas no setup |
|
|
139
|
+
| **Database (phpMyAdmin)** | [https://{{projectDomain}}:8080](https://{{projectDomain}}:8080) | Ver `.lando.yml` |
|
|
140
|
+
| **MailHog** | [https://{{projectDomain}}:8025](https://{{projectDomain}}:8025) | - |
|
|
141
141
|
|
|
142
142
|
## 🛠️ **Comandos Essenciais**
|
|
143
143
|
|
|
@@ -164,7 +164,7 @@ lando destroy
|
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
166
|
# Inicialização completa do WordPress
|
|
167
|
-
lando init-wp --user=seu-email@
|
|
167
|
+
lando init-wp --user=seu-email@{{projectName}}.com
|
|
168
168
|
|
|
169
169
|
# Acesso ao bash do container
|
|
170
170
|
lando bash
|
|
@@ -222,8 +222,8 @@ lando build-theme
|
|
|
222
222
|
lando watch-theme
|
|
223
223
|
|
|
224
224
|
# Ou comandos tradicionais para o tema
|
|
225
|
-
lando bash -c "cd /app/dist/wp-content/themes/
|
|
226
|
-
lando bash -c "cd /app/dist/wp-content/themes/
|
|
225
|
+
lando bash -c "cd /app/dist/wp-content/themes/{{projectThemeSlug}} && npm install"
|
|
226
|
+
lando bash -c "cd /app/dist/wp-content/themes/{{projectThemeSlug}} && npm run dev"
|
|
227
227
|
```
|
|
228
228
|
|
|
229
229
|
## 📁 **Estrutura de Desenvolvimento**
|
|
@@ -231,7 +231,7 @@ lando bash -c "cd /app/dist/wp-content/themes/pipefy-2020 && npm run dev"
|
|
|
231
231
|
### Arquivos Importantes
|
|
232
232
|
|
|
233
233
|
```
|
|
234
|
-
|
|
234
|
+
{{projectName}}/
|
|
235
235
|
├── 📄 .lando.yml # ⭐ Configuração com toolings customizados
|
|
236
236
|
├── 📄 .env.example # Variáveis de ambiente exemplo
|
|
237
237
|
├── 📂 database/ # Dumps do banco de dados
|
|
@@ -243,7 +243,7 @@ pipefy-website/
|
|
|
243
243
|
│ └── 📄 scripts/ # Scripts de automação (usados pelos toolings)
|
|
244
244
|
├── 📂 dist/ # WordPress core
|
|
245
245
|
│ └── 📂 wp-content/
|
|
246
|
-
│ ├── 📂 themes/
|
|
246
|
+
│ ├── 📂 themes/{{projectThemeSlug}}/ # Tema principal
|
|
247
247
|
│ ├── 📂 plugins/ # Plugins
|
|
248
248
|
│ └── 📂 uploads/ # Media files
|
|
249
249
|
└── 📂 logs/ # Logs locais
|
|
@@ -266,7 +266,7 @@ git checkout -b feature/nova-funcionalidade
|
|
|
266
266
|
# Usar nossos toolings para build/watch se necessário
|
|
267
267
|
lando watch-theme # Se configurado
|
|
268
268
|
|
|
269
|
-
# 4. Testar em https://
|
|
269
|
+
# 4. Testar em https://{{projectDomain}}
|
|
270
270
|
|
|
271
271
|
# 5. Commit e push
|
|
272
272
|
git add .
|
|
@@ -322,10 +322,10 @@ lando php -m | grep xdebug
|
|
|
322
322
|
|
|
323
323
|
## 🎨 **Desenvolvimento do Tema**
|
|
324
324
|
|
|
325
|
-
### Estrutura do Tema
|
|
325
|
+
### Estrutura do Tema {{projectTitle}} Theme
|
|
326
326
|
|
|
327
327
|
```
|
|
328
|
-
themes/
|
|
328
|
+
themes/{{projectThemeSlug}}/
|
|
329
329
|
├── 📄 style.css # CSS principal
|
|
330
330
|
├── 📄 functions.php # Funções do tema
|
|
331
331
|
├── 📄 index.php # Template principal
|
|
@@ -347,7 +347,7 @@ lando clear-cache # Limpeza de cache
|
|
|
347
347
|
lando bash
|
|
348
348
|
|
|
349
349
|
# Dentro do container
|
|
350
|
-
cd /app/dist/wp-content/themes/
|
|
350
|
+
cd /app/dist/wp-content/themes/{{projectThemeSlug}}/
|
|
351
351
|
npm install
|
|
352
352
|
npm run dev
|
|
353
353
|
npm run watch
|
|
@@ -359,8 +359,8 @@ npm run watch
|
|
|
359
359
|
|
|
360
360
|
```bash
|
|
361
361
|
# Testar URLs principais
|
|
362
|
-
curl -I https://
|
|
363
|
-
curl -I https://
|
|
362
|
+
curl -I https://{{projectDomain}}/
|
|
363
|
+
curl -I https://{{projectDomain}}/wp-admin/
|
|
364
364
|
|
|
365
365
|
# Verificar plugins ativos
|
|
366
366
|
lando wp plugin list --status=active
|
|
@@ -380,7 +380,7 @@ lando wp option get siteurl
|
|
|
380
380
|
|
|
381
381
|
```bash
|
|
382
382
|
# Verificar queries pesadas (Query Monitor plugin)
|
|
383
|
-
# Acessar: https://
|
|
383
|
+
# Acessar: https://{{projectDomain}}/?qm_debug=1
|
|
384
384
|
|
|
385
385
|
# Logs de erro PHP usando nosso tooling
|
|
386
386
|
lando logs-live
|
|
@@ -401,14 +401,14 @@ lando db-import database/dump.sql --no-autocommit
|
|
|
401
401
|
lando mysql -e "REPAIR TABLE wp_posts;"
|
|
402
402
|
|
|
403
403
|
# URLs erradas após importação
|
|
404
|
-
lando wp search-replace '
|
|
405
|
-
lando wp search-replace 'https://
|
|
404
|
+
lando wp search-replace '{{projectProductionDomain}}' '{{projectDomain}}'
|
|
405
|
+
lando wp search-replace 'https://{{projectProductionDomain}}' 'https://{{projectDomain}}'
|
|
406
406
|
|
|
407
407
|
# Reset completo usando nossos toolings
|
|
408
408
|
lando destroy -y
|
|
409
409
|
lando start
|
|
410
410
|
lando db-import database/production-dump-YYYY-MM-DD.sql
|
|
411
|
-
lando init-wp --user=seu-email@
|
|
411
|
+
lando init-wp --user=seu-email@{{projectName}}.com
|
|
412
412
|
```
|
|
413
413
|
|
|
414
414
|
### Problemas de SSL
|
|
@@ -490,9 +490,9 @@ Após completar o setup, verifique:
|
|
|
490
490
|
- [ ] ✅ **Banco baixado** da produção via GitLab CI/CD
|
|
491
491
|
- [ ] ✅ **Banco restaurado** ANTES da inicialização
|
|
492
492
|
- [ ] ✅ **WordPress inicializado** com `lando init-wp`
|
|
493
|
-
- [ ] ✅ **Site carrega** em `https://
|
|
494
|
-
- [ ] ✅ **Admin acessível** em `https://
|
|
495
|
-
- [ ] ✅ **Tema
|
|
493
|
+
- [ ] ✅ **Site carrega** em `https://{{projectDomain}}`
|
|
494
|
+
- [ ] ✅ **Admin acessível** em `https://{{projectDomain}}/wp-admin`
|
|
495
|
+
- [ ] ✅ **Tema {{projectTitle}} Theme** ativo
|
|
496
496
|
- [ ] ✅ **Plugins principais** instalados
|
|
497
497
|
- [ ] ✅ **Dados de produção** visíveis (posts, páginas)
|
|
498
498
|
- [ ] ✅ **URLs corretas** (apontando para local)
|
|
@@ -509,15 +509,15 @@ Agora que seu ambiente está funcionando:
|
|
|
509
509
|
|
|
510
510
|
## 📞 **Precisa de Ajuda?**
|
|
511
511
|
|
|
512
|
-
- **Issues técnicos**: [GitLab Issues](
|
|
512
|
+
- **Issues técnicos**: [GitLab Issues]({{repositoryWebUrl}}/-/issues)
|
|
513
513
|
- **Dúvidas**: Confira [FAQ](FAQ) ou [Troubleshooting](Troubleshooting)
|
|
514
|
-
- **Equipe**: Consulte [CODEOWNERS](
|
|
514
|
+
- **Equipe**: Consulte [CODEOWNERS]({{repositoryWebUrl}}/-/blob/master/CODEOWNERS)
|
|
515
515
|
|
|
516
516
|
---
|
|
517
517
|
|
|
518
518
|
📝 **Tempo estimado de setup**: 15-30 minutos (usando nossos toolings)
|
|
519
519
|
🔄 **Última atualização**: Junho 2025
|
|
520
|
-
✨ **Ambiente local**: `
|
|
520
|
+
✨ **Ambiente local**: `{{projectDomain}}`
|
|
521
521
|
💾 **Banco de dados**: Produção via GitLab CI/CD Schedules
|
|
522
522
|
🔄 **Sincronização**: Processo repetível para manter ambiente atualizado
|
|
523
523
|
⚡ **Toolings**: Usando comandos customizados do `.lando.yml`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🏗️ Infraestrutura
|
|
2
2
|
|
|
3
|
-
Documentação da infraestrutura do
|
|
3
|
+
Documentação da infraestrutura do {{projectTitle}} Website, incluindo componentes, configurações e pontos que necessitam detalhamento pela equipe SRE.
|
|
4
4
|
|
|
5
5
|
## 🌍 **Visão Geral da Infraestrutura**
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 📊 Monitoramento
|
|
2
2
|
|
|
3
|
-
Documentação do sistema de monitoramento e observabilidade do
|
|
3
|
+
Documentação do sistema de monitoramento e observabilidade do {{projectTitle}} Website, incluindo métricas, alertas e pontos que necessitam detalhamento pela equipe SRE.
|
|
4
4
|
|
|
5
5
|
## 🎯 **Visão Geral do Monitoramento**
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
1. Inside GitLab:
|
|
2
|
-
1. Go to [CI/CD -> Schedules](
|
|
2
|
+
1. Go to [CI/CD -> Schedules]({{repositoryWebUrl}}/-/pipeline_schedules).
|
|
3
3
|
2. Press the play button on the `Download Prod Database` scheduled pipeline.
|
|
4
4
|
1. It'll create a database backup and store it in the S3 bucket.
|
|
5
5
|
3. After finishing the job above, press the play button on the `Replicate Production DB into Staging DB` scheduled pipeline.
|
|
@@ -4,46 +4,172 @@ import fs from 'fs-extra';
|
|
|
4
4
|
|
|
5
5
|
import { log, color } from '../../lib/utils/logger.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Derive a StudlyCase PSR-4 namespace fragment from a kebab/snake plugin slug.
|
|
9
|
+
*
|
|
10
|
+
* futrading-core -> FutradingCore
|
|
11
|
+
* ecoautomacao-core -> EcoautomacaoCore
|
|
12
|
+
* my_plugin -> MyPlugin
|
|
13
|
+
*/
|
|
14
|
+
function toStudlyCase(slug) {
|
|
15
|
+
return slug
|
|
16
|
+
.split(/[-_]/)
|
|
17
|
+
.filter(Boolean)
|
|
18
|
+
.map((segment) => segment[0].toUpperCase() + segment.slice(1).toLowerCase())
|
|
19
|
+
.join('');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Derive an UPPER_SNAKE constant prefix from a kebab/snake plugin slug.
|
|
24
|
+
*
|
|
25
|
+
* futrading-core -> FUTRADING_CORE
|
|
26
|
+
* ecoautomacao-core -> ECOAUTOMACAO_CORE
|
|
27
|
+
*/
|
|
28
|
+
function toConstantPrefix(slug) {
|
|
29
|
+
return slug
|
|
30
|
+
.split(/[-_]/)
|
|
31
|
+
.filter(Boolean)
|
|
32
|
+
.map((segment) => segment.toUpperCase())
|
|
33
|
+
.join('_');
|
|
34
|
+
}
|
|
35
|
+
|
|
7
36
|
export async function setupModule(context, generator) {
|
|
8
37
|
const pluginName = context.mu_plugin_name || `${context.projectName}-core`;
|
|
38
|
+
const useAcorn = context.mu_plugin_acorn !== false; // default to Acorn-flavored
|
|
9
39
|
const pluginDir = `content/mu-plugins/${pluginName}`;
|
|
10
40
|
const absolutePluginDir = path.join(generator.cwd, pluginDir);
|
|
11
41
|
|
|
12
|
-
|
|
42
|
+
// Enrich the template context with derived identifiers used by both flavors.
|
|
43
|
+
const pluginContext = {
|
|
44
|
+
...context,
|
|
45
|
+
mu_plugin_name: pluginName,
|
|
46
|
+
mu_plugin_namespace: toStudlyCase(pluginName),
|
|
47
|
+
mu_plugin_constant_prefix: toConstantPrefix(pluginName),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
log(
|
|
51
|
+
color.blue,
|
|
52
|
+
`[mu-plugin] 📂 Scaffolding ${useAcorn ? 'Acorn-flavored' : 'minimal'} MU plugin: ${pluginDir}`
|
|
53
|
+
);
|
|
13
54
|
|
|
14
55
|
// 1. Ensure directory exists
|
|
15
56
|
await fs.ensureDir(absolutePluginDir);
|
|
16
57
|
|
|
17
|
-
|
|
58
|
+
if (useAcorn) {
|
|
59
|
+
await scaffoldAcorn(pluginContext, generator, pluginDir, absolutePluginDir);
|
|
60
|
+
} else {
|
|
61
|
+
await scaffoldMinimal(pluginContext, generator, pluginDir, absolutePluginDir);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Lint configs co-located in plugin — always installed (IDE/editor support)
|
|
65
|
+
log(color.blue, '[mu-plugin] 🔧 Installing lint configurations...');
|
|
66
|
+
await generator.copyFile('lint/.prettierrc.json', 'mu-plugin', `${pluginDir}/.prettierrc.json`);
|
|
67
|
+
await generator.copyFile('lint/pint.json', 'mu-plugin', `${pluginDir}/pint.json`);
|
|
68
|
+
if (context.mu_plugin_lint_eslint === true) {
|
|
69
|
+
await generator.copyFile(
|
|
70
|
+
'lint/eslint.config.mjs',
|
|
71
|
+
'mu-plugin',
|
|
72
|
+
`${pluginDir}/eslint.config.mjs`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
log(color.green, `[mu-plugin] ✅ MU plugin scaffolded: ${pluginDir}`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Acorn-flavored MU plugin: Bedrock Autoloader bootstrap + plugin's own
|
|
81
|
+
* vendor/ with Roots Acorn 6.1, ServiceProvider scaffolding, Laravel-style
|
|
82
|
+
* config/app/storage/resources layout, and four documented gotcha fixes
|
|
83
|
+
* baked into the plugin entry file.
|
|
84
|
+
*/
|
|
85
|
+
async function scaffoldAcorn(context, generator, pluginDir, _absolutePluginDir) {
|
|
86
|
+
const { mu_plugin_name: pluginName } = context;
|
|
87
|
+
|
|
88
|
+
// Bedrock Autoloader bootstrap (lives at the mu-plugins root, NOT inside
|
|
89
|
+
// the plugin directory). Required because native WP does not recurse into
|
|
90
|
+
// subdirectory mu-plugins.
|
|
91
|
+
await generator.copyFile(
|
|
92
|
+
'templates/bedrock-autoloader.php',
|
|
93
|
+
'mu-plugin',
|
|
94
|
+
'content/mu-plugins/bedrock-autoloader.php'
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Plugin entry file (Acorn boot, WP-CLI guard, APP_DEBUG=false, Filesystem provider)
|
|
18
98
|
await generator.generateFile(
|
|
19
|
-
'plugin.php',
|
|
20
|
-
|
|
99
|
+
'acorn/plugin.php',
|
|
100
|
+
context,
|
|
21
101
|
'mu-plugin',
|
|
22
102
|
`${pluginDir}/${pluginName}.php`
|
|
23
103
|
);
|
|
24
104
|
|
|
25
|
-
//
|
|
105
|
+
// composer.json with type=wordpress-muplugin, Acorn + acf-composer, allow-plugins
|
|
26
106
|
await generator.generateFile(
|
|
27
|
-
'composer.json',
|
|
28
|
-
|
|
107
|
+
'acorn/composer.json',
|
|
108
|
+
context,
|
|
29
109
|
'mu-plugin',
|
|
30
110
|
`${pluginDir}/composer.json`
|
|
31
111
|
);
|
|
32
112
|
|
|
33
|
-
//
|
|
34
|
-
await
|
|
113
|
+
// .gitignore for vendor/, composer.lock, storage runtime
|
|
114
|
+
await generator.generateFile('acorn/.gitignore', context, 'mu-plugin', `${pluginDir}/.gitignore`);
|
|
35
115
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
116
|
+
// README.md (purpose + structure + install + documented traps)
|
|
117
|
+
await generator.generateFile('acorn/README.md', context, 'mu-plugin', `${pluginDir}/README.md`);
|
|
118
|
+
|
|
119
|
+
// config/ files
|
|
120
|
+
await generator.generateFile(
|
|
121
|
+
'acorn/config/app.php',
|
|
122
|
+
context,
|
|
123
|
+
'mu-plugin',
|
|
124
|
+
`${pluginDir}/config/app.php`
|
|
125
|
+
);
|
|
126
|
+
await generator.generateFile(
|
|
127
|
+
'acorn/config/logging.php',
|
|
128
|
+
context,
|
|
129
|
+
'mu-plugin',
|
|
130
|
+
`${pluginDir}/config/logging.php`
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
// app/Providers/CoreServiceProvider.php stub
|
|
134
|
+
await generator.generateFile(
|
|
135
|
+
'acorn/app/Providers/CoreServiceProvider.php',
|
|
136
|
+
context,
|
|
137
|
+
'mu-plugin',
|
|
138
|
+
`${pluginDir}/app/Providers/CoreServiceProvider.php`
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
// Storage and resources scaffolding (.gitkeep markers committed; runtime
|
|
142
|
+
// contents are ignored via .gitignore above).
|
|
143
|
+
for (const subdir of [
|
|
144
|
+
'storage/framework/cache',
|
|
145
|
+
'storage/framework/views',
|
|
146
|
+
'storage/framework/sessions',
|
|
147
|
+
'storage/logs',
|
|
148
|
+
'resources',
|
|
149
|
+
]) {
|
|
41
150
|
await generator.copyFile(
|
|
42
|
-
|
|
151
|
+
`templates/acorn/${subdir}/.gitkeep`,
|
|
43
152
|
'mu-plugin',
|
|
44
|
-
`${pluginDir}
|
|
153
|
+
`${pluginDir}/${subdir}/.gitkeep`
|
|
45
154
|
);
|
|
46
155
|
}
|
|
156
|
+
}
|
|
47
157
|
|
|
48
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Minimal MU plugin: legacy single-file scaffold with PSR-4 `App\MuPlugins\\`
|
|
160
|
+
* to `src/`. Retained for projects that explicitly opt out of Acorn.
|
|
161
|
+
*/
|
|
162
|
+
async function scaffoldMinimal(context, generator, pluginDir, absolutePluginDir) {
|
|
163
|
+
const { mu_plugin_name: pluginName } = context;
|
|
164
|
+
|
|
165
|
+
await generator.generateFile(
|
|
166
|
+
'plugin.php',
|
|
167
|
+
context,
|
|
168
|
+
'mu-plugin',
|
|
169
|
+
`${pluginDir}/${pluginName}.php`
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
await generator.generateFile('composer.json', context, 'mu-plugin', `${pluginDir}/composer.json`);
|
|
173
|
+
|
|
174
|
+
await fs.ensureFile(path.join(absolutePluginDir, 'src', '.gitkeep'));
|
|
49
175
|
}
|