@brunoluizdesiqueira/bbuilder-cli 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -311
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,206 +1,41 @@
|
|
|
1
1
|
# bbuilder-cli
|
|
2
2
|
|
|
3
|
-
CLI
|
|
3
|
+
CLI para build local de projetos Delphi do Bimer.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Substitui o `build_local.bat` com:
|
|
6
|
+
- seleção interativa de projeto, modo e versão
|
|
7
|
+
- suporte a `FAST`, `DEBUG` e `RELEASE`
|
|
8
|
+
- configuração por arquivo `bbuilder.config.json`
|
|
9
|
+
- diagnóstico de ambiente com `doctor`
|
|
6
10
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Desenvolvimento local
|
|
11
|
-
npm install
|
|
12
|
-
npm run build
|
|
13
|
-
npm link # disponibiliza o comando 'bbuilder' globalmente
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Instalação via npm
|
|
18
|
-
npm install -g @brunoluizdesiqueira/bbuilder-cli
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Publicação
|
|
23
|
-
npm publish --access public
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Publicação
|
|
27
|
-
|
|
28
|
-
### Publicação manual inicial
|
|
29
|
-
|
|
30
|
-
Use esse fluxo para a primeira publicação ou para publicar manualmente uma versão:
|
|
31
|
-
|
|
32
|
-
1. Faça login no npm:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm login
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
2. Valide o pacote localmente:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm run build
|
|
42
|
-
npm pack --dry-run
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
3. Publique:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npm publish --access public
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Se a versão atual do `package.json` já tiver sido publicada, gere uma nova versão antes:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm version patch --no-git-tag-version
|
|
55
|
-
npm publish --access public
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Configurar publicação automática
|
|
59
|
-
|
|
60
|
-
Depois da primeira publicação manual, configure o npm para confiar no workflow do GitHub Actions.
|
|
61
|
-
|
|
62
|
-
No npm:
|
|
63
|
-
|
|
64
|
-
1. abra a página do pacote `@brunoluizdesiqueira/bbuilder-cli`
|
|
65
|
-
2. vá em `Settings`
|
|
66
|
-
3. abra `Trusted publishing`
|
|
67
|
-
4. adicione um publisher do tipo `GitHub Actions`
|
|
68
|
-
5. configure:
|
|
69
|
-
- repositório: `brunoluizdesiqueira/b-cli`
|
|
70
|
-
- workflow: `release.yml`
|
|
71
|
-
|
|
72
|
-
Na opção **Publishing access**, use:
|
|
73
|
-
|
|
74
|
-
- `Require two-factor authentication or a granular access token with bypass 2fa enabled`
|
|
75
|
-
|
|
76
|
-
Evite para esse fluxo:
|
|
77
|
-
|
|
78
|
-
- `Require two-factor authentication and disallow tokens`
|
|
79
|
-
|
|
80
|
-
### Publicação automática com Changesets
|
|
81
|
-
|
|
82
|
-
Depois do Trusted Publisher configurado, o fluxo recomendado fica assim:
|
|
83
|
-
|
|
84
|
-
1. criar uma changeset para cada mudança publicada:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
npm run changeset
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
2. fazer commit da changeset junto com o código
|
|
91
|
-
3. abrir PR e fazer merge na `main`
|
|
92
|
-
4. o workflow `Release` abre ou atualiza uma PR de release
|
|
93
|
-
5. ao mergear a PR de release, o npm é publicado automaticamente
|
|
94
|
-
|
|
95
|
-
Comandos locais úteis:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
npm run changeset
|
|
99
|
-
npm run version-packages
|
|
100
|
-
npm run release
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Troubleshooting do publish automático
|
|
104
|
-
|
|
105
|
-
Se a PR de release for mergeada, a versão subir para o `package.json`, mas o publish no npm falhar com erro parecido com:
|
|
106
|
-
|
|
107
|
-
```text
|
|
108
|
-
E404 Not Found - PUT https://registry.npmjs.org/@brunoluizdesiqueira%2fbbuilder-cli - Not found
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
verifique estes pontos:
|
|
112
|
-
|
|
113
|
-
1. o Trusted Publisher do pacote está configurado para:
|
|
114
|
-
- owner/user: `brunoluizdesiqueira`
|
|
115
|
-
- repository: `b-cli`
|
|
116
|
-
- workflow: `release.yml`
|
|
117
|
-
2. o repositório GitHub é público
|
|
118
|
-
3. o workflow `Release` tem `permissions.id-token: write`
|
|
119
|
-
4. o workflow roda com Node e npm atuais
|
|
120
|
-
|
|
121
|
-
O ajuste que resolveu esse cenário neste projeto foi:
|
|
122
|
-
|
|
123
|
-
- usar `actions/setup-node@v5`
|
|
124
|
-
- executar o workflow com Node `24`
|
|
125
|
-
- atualizar o npm antes do publish
|
|
126
|
-
- definir no `package.json`:
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
"publishConfig": {
|
|
130
|
-
"access": "public",
|
|
131
|
-
"provenance": true
|
|
132
|
-
}
|
|
133
|
-
```
|
|
11
|
+
## Requisitos
|
|
134
12
|
|
|
135
|
-
|
|
13
|
+
- Node.js 18+
|
|
14
|
+
- Windows
|
|
15
|
+
- Delphi instalado
|
|
16
|
+
- bibliotecas do projeto disponíveis na máquina
|
|
136
17
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
- `CI`: roda em `push` e `pull_request`, executando `npm ci`, `tsc`, `build` e `npm pack --dry-run`
|
|
140
|
-
- `Release`: usa `changesets` para abrir uma PR de release com bump de versão e changelog; quando essa PR entra na `main`, o pacote é publicado no npm
|
|
18
|
+
## Instalação
|
|
141
19
|
|
|
142
|
-
Ou use direto sem instalar globalmente:
|
|
143
20
|
```bash
|
|
144
|
-
|
|
21
|
+
npm install -g @brunoluizdesiqueira/bbuilder-cli
|
|
145
22
|
```
|
|
146
23
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
## Uso
|
|
150
|
-
|
|
151
|
-
### Modo interativo (sem argumentos)
|
|
152
|
-
```bash
|
|
153
|
-
bbuilder
|
|
154
|
-
```
|
|
155
|
-
Exibe menus para escolher: modo de build → projeto → versão.
|
|
24
|
+
Depois confirme:
|
|
156
25
|
|
|
157
|
-
### Comando `build` com flags opcionais
|
|
158
26
|
```bash
|
|
159
|
-
bbuilder
|
|
160
|
-
bbuilder build --type DEBUG # escolhe projeto e versão interativamente
|
|
161
|
-
bbuilder build --type FAST --project faturamento\BimerFaturamento
|
|
162
|
-
bbuilder build --type RELEASE --project Bimer --version 11.3.1
|
|
27
|
+
bbuilder --version
|
|
163
28
|
```
|
|
164
29
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
### Atalhos diretos por modo
|
|
168
|
-
```bash
|
|
169
|
-
bbuilder fast # interativo para projeto/versão
|
|
170
|
-
bbuilder debug --project Bimer
|
|
171
|
-
bbuilder release --project Bimer --version 11.3.1
|
|
172
|
-
```
|
|
30
|
+
## Configuração
|
|
173
31
|
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
bbuilder project list # lista projetos configurados
|
|
177
|
-
bbuilder project add # adiciona novo projeto (interativo)
|
|
178
|
-
bbuilder project remove # remove projeto (interativo ou por --name)
|
|
179
|
-
```
|
|
32
|
+
Crie a configuração inicial:
|
|
180
33
|
|
|
181
|
-
### Configuração do ambiente
|
|
182
34
|
```bash
|
|
183
|
-
bbuilder config init
|
|
184
|
-
bbuilder config show # exibe configuração atual
|
|
185
|
-
bbuilder config validate # valida a estrutura do arquivo de configuração
|
|
186
|
-
bbuilder doctor # diagnostica ambiente, config e paths
|
|
35
|
+
bbuilder config init
|
|
187
36
|
```
|
|
188
37
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
## Configuração (`bbuilder.config.json`)
|
|
192
|
-
|
|
193
|
-
Prioridade de resolução da configuração:
|
|
194
|
-
|
|
195
|
-
1. `bbuilder --config <caminho>`
|
|
196
|
-
2. Variável de ambiente `BBUILDER_CONFIG`
|
|
197
|
-
3. `bbuilder.config.json` no diretório atual
|
|
198
|
-
4. `bimer.config.json` no diretório atual, por compatibilidade
|
|
199
|
-
5. Arquivo global do usuário
|
|
200
|
-
|
|
201
|
-
No Windows, o arquivo global fica em `%APPDATA%\bbuilder-cli\bbuilder.config.json`.
|
|
202
|
-
|
|
203
|
-
Crie com `bbuilder config init`, ou manualmente:
|
|
38
|
+
Ou use um arquivo manual como este:
|
|
204
39
|
|
|
205
40
|
```json
|
|
206
41
|
{
|
|
@@ -218,181 +53,129 @@ Crie com `bbuilder config init`, ou manualmente:
|
|
|
218
53
|
],
|
|
219
54
|
"projects": {
|
|
220
55
|
"BimerFaturamento": "faturamento\\BimerFaturamento",
|
|
221
|
-
"Bimer": "Bimer"
|
|
222
|
-
"LiberadorEstoque": "geral\\gerenteeletronico.jobs.liberadorestoque\\LiberadorEstoque",
|
|
223
|
-
"BimerEstoque": "estoque\\BimerEstoque"
|
|
56
|
+
"Bimer": "Bimer"
|
|
224
57
|
}
|
|
225
58
|
}
|
|
226
59
|
```
|
|
227
60
|
|
|
228
|
-
`dependencyPaths`
|
|
229
|
-
|
|
230
|
-
`projects` agora usa o formato `nome amigável: caminho real do projeto`, para a CLI exibir nomes humanizados sem perder a referência correta de compilação.
|
|
61
|
+
`dependencyPaths` varia por máquina e deve ser ajustado por usuário.
|
|
231
62
|
|
|
232
|
-
|
|
63
|
+
## Resolução da Configuração
|
|
233
64
|
|
|
234
|
-
|
|
65
|
+
Ordem de prioridade:
|
|
235
66
|
|
|
236
|
-
|
|
67
|
+
1. `--config <caminho>`
|
|
68
|
+
2. variável de ambiente `BBUILDER_CONFIG`
|
|
69
|
+
3. `bbuilder.config.json` no diretório atual
|
|
70
|
+
4. `bimer.config.json` no diretório atual, por compatibilidade
|
|
71
|
+
5. arquivo global do usuário
|
|
237
72
|
|
|
238
|
-
|
|
73
|
+
No Windows, o arquivo global padrão fica em:
|
|
239
74
|
|
|
240
|
-
```
|
|
241
|
-
|
|
75
|
+
```text
|
|
76
|
+
%APPDATA%\bbuilder-cli\bbuilder.config.json
|
|
242
77
|
```
|
|
243
78
|
|
|
244
|
-
|
|
79
|
+
Exemplos:
|
|
245
80
|
|
|
246
81
|
```bash
|
|
247
82
|
bbuilder --config C:\configs\bbuilder.config.json build
|
|
248
83
|
```
|
|
249
84
|
|
|
250
|
-
Usando variável de ambiente no Windows CMD:
|
|
251
|
-
|
|
252
85
|
```bat
|
|
253
86
|
set BBUILDER_CONFIG=C:\configs\bbuilder.config.json
|
|
254
87
|
bbuilder build
|
|
255
88
|
```
|
|
256
89
|
|
|
257
|
-
Usando variável de ambiente no PowerShell:
|
|
258
|
-
|
|
259
90
|
```powershell
|
|
260
91
|
$env:BBUILDER_CONFIG="C:\configs\bbuilder.config.json"
|
|
261
92
|
bbuilder build
|
|
262
93
|
```
|
|
263
94
|
|
|
264
|
-
|
|
95
|
+
## Uso
|
|
96
|
+
|
|
97
|
+
Modo interativo:
|
|
265
98
|
|
|
266
|
-
|
|
99
|
+
```bash
|
|
100
|
+
bbuilder
|
|
101
|
+
```
|
|
267
102
|
|
|
268
|
-
|
|
103
|
+
Build direto:
|
|
269
104
|
|
|
270
105
|
```bash
|
|
271
|
-
bbuilder
|
|
106
|
+
bbuilder build --type DEBUG --project BimerFaturamento --version 11.3.1
|
|
107
|
+
bbuilder build --type FAST --project Bimer
|
|
108
|
+
bbuilder build --type RELEASE --project Bimer
|
|
272
109
|
```
|
|
273
110
|
|
|
274
|
-
|
|
111
|
+
Atalhos:
|
|
275
112
|
|
|
276
113
|
```bash
|
|
277
|
-
bbuilder
|
|
114
|
+
bbuilder fast
|
|
115
|
+
bbuilder debug --project Bimer
|
|
116
|
+
bbuilder release --project Bimer --version 11.3.1
|
|
278
117
|
```
|
|
279
118
|
|
|
119
|
+
Projetos:
|
|
120
|
+
|
|
280
121
|
```bash
|
|
281
|
-
|
|
122
|
+
bbuilder project list
|
|
123
|
+
bbuilder project add
|
|
124
|
+
bbuilder project remove
|
|
125
|
+
bbuilder project remove --name Bimer
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Configuração:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
bbuilder config init
|
|
282
132
|
bbuilder config show
|
|
133
|
+
bbuilder config validate
|
|
134
|
+
bbuilder doctor
|
|
283
135
|
```
|
|
284
136
|
|
|
285
|
-
|
|
137
|
+
## Observações de Uso
|
|
286
138
|
|
|
287
|
-
|
|
139
|
+
- o build mostra etapas com tempo decorrido
|
|
140
|
+
- `cgrc` e `dcc64` escrevem diretamente no terminal durante a compilação
|
|
141
|
+
- no PowerShell, a saída do compilador pode ser menos verbosa que no `cmd`, mesmo com o build funcionando corretamente
|
|
288
142
|
|
|
289
|
-
|
|
143
|
+
Se o PowerShell bloquear `npm` ou `bbuilder`, ajuste a policy do usuário:
|
|
290
144
|
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
"version": "2.0.0",
|
|
294
|
-
"tasks": [
|
|
295
|
-
{
|
|
296
|
-
"label": "Bimer: FAST + Run",
|
|
297
|
-
"type": "shell",
|
|
298
|
-
"command": "bbuilder fast",
|
|
299
|
-
"group": "build",
|
|
300
|
-
"presentation": { "reveal": "always", "focus": true, "panel": "dedicated", "clear": true },
|
|
301
|
-
"problemMatcher": {
|
|
302
|
-
"owner": "delphi",
|
|
303
|
-
"fileLocation": ["autoDetect", "${workspaceFolder}"],
|
|
304
|
-
"pattern": {
|
|
305
|
-
"regexp": "^(.*?)\\s*\\((\\d+)\\)(?:\\s+|:\\s*)(Fatal|Error|Warning|Hint|error|fatal):\\s+(.*)$",
|
|
306
|
-
"file": 1, "line": 2, "severity": 3, "message": 4
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
"label": "Bimer: DEBUG + Run",
|
|
312
|
-
"type": "shell",
|
|
313
|
-
"command": "bbuilder debug",
|
|
314
|
-
"group": "build",
|
|
315
|
-
"presentation": { "reveal": "always", "focus": true, "panel": "dedicated", "clear": true },
|
|
316
|
-
"problemMatcher": {
|
|
317
|
-
"owner": "delphi",
|
|
318
|
-
"fileLocation": ["autoDetect", "${workspaceFolder}"],
|
|
319
|
-
"pattern": {
|
|
320
|
-
"regexp": "^(.*?)\\s*\\((\\d+)\\)(?:\\s+|:\\s*)(Fatal|Error|Warning|Hint|error|fatal):\\s+(.*)$",
|
|
321
|
-
"file": 1, "line": 2, "severity": 3, "message": 4
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"label": "Bimer: RELEASE",
|
|
327
|
-
"type": "shell",
|
|
328
|
-
"command": "bbuilder release",
|
|
329
|
-
"group": "build",
|
|
330
|
-
"presentation": { "reveal": "always", "focus": true, "panel": "dedicated", "clear": true },
|
|
331
|
-
"problemMatcher": {
|
|
332
|
-
"owner": "delphi",
|
|
333
|
-
"fileLocation": ["autoDetect", "${workspaceFolder}"],
|
|
334
|
-
"pattern": {
|
|
335
|
-
"regexp": "^(.*?)\\s*\\((\\d+)\\)(?:\\s+|:\\s*)(Fatal|Error|Warning|Hint|error|fatal):\\s+(.*)$",
|
|
336
|
-
"file": 1, "line": 2, "severity": 3, "message": 4
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
]
|
|
341
|
-
}
|
|
145
|
+
```powershell
|
|
146
|
+
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
|
|
342
147
|
```
|
|
343
148
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
---
|
|
149
|
+
## Troubleshooting
|
|
347
150
|
|
|
348
|
-
|
|
151
|
+
Validar ambiente:
|
|
349
152
|
|
|
153
|
+
```bash
|
|
154
|
+
bbuilder doctor
|
|
350
155
|
```
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
│ └── workflows/
|
|
357
|
-
│ ├── ci.yml
|
|
358
|
-
│ └── release.yml
|
|
359
|
-
├── src/
|
|
360
|
-
│ ├── build/
|
|
361
|
-
│ │ ├── compiler.ts
|
|
362
|
-
│ │ ├── execute.ts
|
|
363
|
-
│ │ ├── project.ts
|
|
364
|
-
│ │ └── resources.ts
|
|
365
|
-
│ ├── cli/
|
|
366
|
-
│ │ └── program.ts
|
|
367
|
-
│ ├── config/
|
|
368
|
-
│ │ ├── config.ts
|
|
369
|
-
│ │ └── validate.ts
|
|
370
|
-
│ ├── diagnostics/
|
|
371
|
-
│ │ └── doctor.ts
|
|
372
|
-
│ ├── ui/
|
|
373
|
-
│ │ ├── output.ts
|
|
374
|
-
│ │ └── prompts.ts
|
|
375
|
-
│ ├── index.ts
|
|
376
|
-
│ └── types.ts
|
|
377
|
-
├── files/
|
|
378
|
-
│ ├── build_local.bat
|
|
379
|
-
│ ├── tasks.json
|
|
380
|
-
│ └── ...
|
|
381
|
-
├── bbuilder.config.json
|
|
382
|
-
├── package.json
|
|
383
|
-
├── package-lock.json
|
|
384
|
-
├── tsconfig.json
|
|
385
|
-
├── .gitignore
|
|
386
|
-
├── LICENSE
|
|
387
|
-
└── README.md
|
|
156
|
+
|
|
157
|
+
Validar configuração:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
bbuilder config validate
|
|
388
161
|
```
|
|
389
162
|
|
|
390
|
-
|
|
163
|
+
Erro `Unit not found: 'System'` normalmente indica problema em:
|
|
164
|
+
- `delphiDir`
|
|
165
|
+
- `dependencyPaths`
|
|
166
|
+
- path `...\lib\Win64\release` ausente na configuração
|
|
167
|
+
|
|
168
|
+
## Publicação
|
|
169
|
+
|
|
170
|
+
Para usuários, nada além de instalar o pacote é necessário.
|
|
171
|
+
|
|
172
|
+
Para mantenedores, o fluxo é:
|
|
173
|
+
- criar changeset
|
|
174
|
+
- abrir PR
|
|
175
|
+
- mergear na `main`
|
|
176
|
+
- mergear a PR automática de release
|
|
177
|
+
- publicação no npm ocorre via GitHub Actions
|
|
178
|
+
|
|
179
|
+
## Licença
|
|
391
180
|
|
|
392
|
-
|
|
393
|
-
|---|---|
|
|
394
|
-
| **commander** | Parsing de comandos e flags |
|
|
395
|
-
| **inquirer** | Menus interativos com setas |
|
|
396
|
-
| **chalk** | Cores ANSI no terminal |
|
|
397
|
-
| **execa** | Spawn de processos externos (CGRC, DCC64) |
|
|
398
|
-
| **typescript** | Tipagem, autocomplete, menos bugs |
|
|
181
|
+
ISC
|