@brunoluizdesiqueira/bbuilder-cli 1.0.22 → 1.0.23
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 +52 -3
- package/dist/build/compiler.js +6 -3
- package/dist/build/validate-commands.js +107 -0
- package/dist/cli/program.js +15 -0
- package/dist/config/config.js +62 -26
- package/dist/config/validate.js +10 -0
- package/dist/diagnostics/doctor.js +1 -0
- package/dist/ui/prompts.js +18 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ CLI para build local de projetos Delphi.
|
|
|
6
6
|
- suporte a `FAST`, `DEBUG` e `RELEASE`
|
|
7
7
|
- configuração por arquivo `bbuilder.config.json`
|
|
8
8
|
- diagnóstico de ambiente com `doctor`
|
|
9
|
+
- validação de comandos com `validate-commands`
|
|
9
10
|
|
|
10
11
|
## Requisitos
|
|
11
12
|
|
|
@@ -41,9 +42,12 @@ Ou use um arquivo manual como este:
|
|
|
41
42
|
"repoBase": "C:\\git\\bimer",
|
|
42
43
|
"delphiDir": "C:\\Program Files (x86)\\Embarcadero\\Studio\\22.0",
|
|
43
44
|
"envVersion": "11.03.00",
|
|
44
|
-
"libRoot": "C:\\LibraryDelphiAlexandria
|
|
45
|
-
"
|
|
46
|
-
"
|
|
45
|
+
"libRoot": "C:\\LibraryDelphiAlexandria",
|
|
46
|
+
"libExternos": "${libRoot}\\Externos\\3.00",
|
|
47
|
+
"libErp": "${libRoot}\\ERP\\${envVersion}",
|
|
48
|
+
"libAlterdata": "${libRoot}\\LibAlterdata\\1.0.0",
|
|
49
|
+
"exeOutputDir": "C:\\Temp\\${envVersion}\\EXE",
|
|
50
|
+
"dcuOutputDir": "C:\\Temp\\${envVersion}\\DCU",
|
|
47
51
|
"dependencyPaths": [
|
|
48
52
|
"C:\\git\\bimer\\dependencies",
|
|
49
53
|
"C:\\Program Files (x86)\\Embarcadero\\Studio\\22.0\\lib\\Win64\\release",
|
|
@@ -57,6 +61,25 @@ Ou use um arquivo manual como este:
|
|
|
57
61
|
}
|
|
58
62
|
```
|
|
59
63
|
|
|
64
|
+
### Templates de Paths
|
|
65
|
+
|
|
66
|
+
Os campos de path suportam variáveis que são resolvidas automaticamente:
|
|
67
|
+
|
|
68
|
+
- `${libRoot}` - caminho base da biblioteca (padrão: `C:\LibraryDelphiAlexandria`)
|
|
69
|
+
- `${envVersion}` - versão do ambiente (padrão: `11.03.00`)
|
|
70
|
+
|
|
71
|
+
Exemplos:
|
|
72
|
+
- `"${libRoot}\\Externos\\3.00"` → `"C:\\LibraryDelphiAlexandria\\Externos\\3.00"`
|
|
73
|
+
- `"C:\\Temp\\${envVersion}\\EXE"` → `"C:\\Temp\\11.03.00\\EXE"`
|
|
74
|
+
|
|
75
|
+
Campos que suportam templates:
|
|
76
|
+
- `libRoot` - caminho base da biblioteca
|
|
77
|
+
- `libExternos` - pasta Externos (derivado de libRoot)
|
|
78
|
+
- `libErp` - pasta do ERP (derivado de libRoot e envVersion)
|
|
79
|
+
- `libAlterdata` - pasta LibAlterdata (derivado de libRoot)
|
|
80
|
+
- `exeOutputDir` - diretório de saída do executável
|
|
81
|
+
- `dcuOutputDir` - diretório de saída das units compiladas
|
|
82
|
+
|
|
60
83
|
`dependencyPaths` varia por máquina e deve ser ajustado por usuário.
|
|
61
84
|
|
|
62
85
|
## Resolução da Configuração
|
|
@@ -133,6 +156,26 @@ bbuilder config validate
|
|
|
133
156
|
bbuilder doctor
|
|
134
157
|
```
|
|
135
158
|
|
|
159
|
+
### Validação de Comandos
|
|
160
|
+
|
|
161
|
+
Para verificar quais comandos serão executados sem rodar o build:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
bbuilder validate-commands --type FAST
|
|
165
|
+
bbuilder validate-commands --type DEBUG
|
|
166
|
+
bbuilder validate-commands --type RELEASE
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Opções:
|
|
170
|
+
- `-t, --type` - modo de build (FAST, DEBUG, RELEASE)
|
|
171
|
+
- `-p, --project` - caminho do projeto
|
|
172
|
+
- `-v, --version` - versão do exe
|
|
173
|
+
|
|
174
|
+
Esta ferramenta é útil para:
|
|
175
|
+
- depuração de problemas de build
|
|
176
|
+
- geração de testes unitários
|
|
177
|
+
- verificação de paths e argumentos
|
|
178
|
+
|
|
136
179
|
## Observações de Uso
|
|
137
180
|
|
|
138
181
|
- o build mostra etapas com tempo decorrido
|
|
@@ -159,6 +202,12 @@ Validar configuração:
|
|
|
159
202
|
bbuilder config validate
|
|
160
203
|
```
|
|
161
204
|
|
|
205
|
+
Verificar comandos que serão executados:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
bbuilder validate-commands --type DEBUG
|
|
209
|
+
```
|
|
210
|
+
|
|
162
211
|
Erro `Unit not found: 'System'` normalmente indica problema em:
|
|
163
212
|
- `delphiDir`
|
|
164
213
|
- `dependencyPaths`
|
package/dist/build/compiler.js
CHANGED
|
@@ -46,6 +46,9 @@ const fs = __importStar(require("fs"));
|
|
|
46
46
|
const os = __importStar(require("os"));
|
|
47
47
|
const path = __importStar(require("path"));
|
|
48
48
|
const output_1 = require("../ui/output");
|
|
49
|
+
function resolveEnvTemplate(template, envVersion) {
|
|
50
|
+
return template.replace(/\$\{envVersion\}/g, envVersion).replace(/\$envVersion/g, envVersion);
|
|
51
|
+
}
|
|
49
52
|
const delphiEnvCache = new Map();
|
|
50
53
|
function buildCompilerFlags(buildType) {
|
|
51
54
|
const baseDefines = 'DEBUG;ALT_CEF133_0;EUREKALOG';
|
|
@@ -140,8 +143,8 @@ async function runCgrc(opts, projectName) {
|
|
|
140
143
|
async function runDcc64(opts, projectName, workspaceDir) {
|
|
141
144
|
const { flags, defines } = buildCompilerFlags(opts.type);
|
|
142
145
|
const deps = buildDependencies(opts);
|
|
143
|
-
const exeOut =
|
|
144
|
-
const dcuOut =
|
|
146
|
+
const exeOut = resolveEnvTemplate(opts.exeOutputDir, opts.envVersion);
|
|
147
|
+
const dcuOut = resolveEnvTemplate(opts.dcuOutputDir, opts.envVersion);
|
|
145
148
|
const delphiEnv = await getDelphiEnvironment(opts.delphiDir);
|
|
146
149
|
if (!fs.existsSync(exeOut))
|
|
147
150
|
fs.mkdirSync(exeOut, { recursive: true });
|
|
@@ -187,7 +190,7 @@ function runBuiltExecutable(opts, projectName) {
|
|
|
187
190
|
const { runAfter } = buildCompilerFlags(opts.type);
|
|
188
191
|
if (!runAfter)
|
|
189
192
|
return;
|
|
190
|
-
const exeOut = path.win32.join(
|
|
193
|
+
const exeOut = path.win32.join(resolveEnvTemplate(opts.exeOutputDir, opts.envVersion), `${projectName}.exe`);
|
|
191
194
|
(0, output_1.step)(`Iniciando ${projectName}.exe...`);
|
|
192
195
|
(0, execa_1.default)(exeOut, [], { detached: true, stdio: 'ignore' }).unref();
|
|
193
196
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getDcc64Command = getDcc64Command;
|
|
37
|
+
exports.getBuiltExecutablePath = getBuiltExecutablePath;
|
|
38
|
+
exports.printCommands = printCommands;
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
function getDcc64Command(opts, projectName) {
|
|
41
|
+
const { flags, defines } = buildCompilerFlags(opts.type);
|
|
42
|
+
const deps = buildDependencies(opts);
|
|
43
|
+
const exeOut = resolveEnvTemplate(opts.exeOutputDir, opts.envVersion);
|
|
44
|
+
const dcuOut = resolveEnvTemplate(opts.dcuOutputDir, opts.envVersion);
|
|
45
|
+
const nsValue = 'Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;FireDAC.VCLUI;System.Win;';
|
|
46
|
+
const aliasValue = 'Generics.Collections=System.Generics.Collections;Generics.Defaults=System.Generics.Defaults;WinTypes=Winapi.Windows;WinProcs=Winapi.Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE';
|
|
47
|
+
const dcc64 = path.win32.join(opts.delphiDir, 'bin', 'dcc64.exe');
|
|
48
|
+
const args = [
|
|
49
|
+
...flags,
|
|
50
|
+
'--no-config', '-Q', '-H-', '-W-',
|
|
51
|
+
'-TX.exe',
|
|
52
|
+
`-A${aliasValue}`,
|
|
53
|
+
`-D${defines}`,
|
|
54
|
+
`-E${exeOut}`,
|
|
55
|
+
`-I${deps}`,
|
|
56
|
+
`-LE${exeOut}`,
|
|
57
|
+
`-LN${exeOut}`,
|
|
58
|
+
`-NU${dcuOut}`,
|
|
59
|
+
`-NS${nsValue}`,
|
|
60
|
+
`-O${deps}`,
|
|
61
|
+
`-R${deps}`,
|
|
62
|
+
`-U${deps}`,
|
|
63
|
+
'-K00400000', '-GD',
|
|
64
|
+
`-NB${exeOut}`,
|
|
65
|
+
`-NH${exeOut}`,
|
|
66
|
+
`-NO${dcuOut}`,
|
|
67
|
+
'-W-', '-W-SYMBOL_PLATFORM', '-W-UNIT_PLATFORM', '-W-DUPLICATE_CTOR_DTOR', '-W-IMPLICIT_STRING_CAST',
|
|
68
|
+
`${projectName}.dpr`,
|
|
69
|
+
];
|
|
70
|
+
return { exe: dcc64, args, exeOutputDir: exeOut, dcuOutputDir: dcuOut, projectName };
|
|
71
|
+
}
|
|
72
|
+
function getBuiltExecutablePath(opts, projectName) {
|
|
73
|
+
const exeOut = resolveEnvTemplate(opts.exeOutputDir, opts.envVersion);
|
|
74
|
+
return { exe: path.win32.join(exeOut, `${projectName}.exe`), projectName };
|
|
75
|
+
}
|
|
76
|
+
function printCommands(opts, projectName) {
|
|
77
|
+
console.log('\n=== COMANDOS PARA TESTES ===\n');
|
|
78
|
+
const dcc64 = getDcc64Command(opts, projectName);
|
|
79
|
+
console.log('--- dcc64 (compilação) ---');
|
|
80
|
+
console.log('EXE:', dcc64.exe);
|
|
81
|
+
console.log('ARGS:');
|
|
82
|
+
dcc64.args.forEach((arg, i) => console.log(` ${i}: ${arg}`));
|
|
83
|
+
console.log('\n--- exe (execução pós-build) ---');
|
|
84
|
+
const exe = getBuiltExecutablePath(opts, projectName);
|
|
85
|
+
console.log('EXE:', exe.exe);
|
|
86
|
+
console.log('\n=== FIM COMANDOS ===\n');
|
|
87
|
+
}
|
|
88
|
+
function buildCompilerFlags(buildType) {
|
|
89
|
+
const baseDefines = 'DEBUG;ALT_CEF133_0;EUREKALOG';
|
|
90
|
+
const releaseDefines = 'RELEASE;ALT_CEF133_0;EUREKALOG';
|
|
91
|
+
switch (buildType) {
|
|
92
|
+
case 'FAST':
|
|
93
|
+
return { flags: ['-$W+', '-$J+', '-$D+', '-$L+', '-$Y+', '-$O-'], defines: baseDefines };
|
|
94
|
+
case 'DEBUG':
|
|
95
|
+
return { flags: ['-B', '-$W+', '-$J+', '-$D+', '-$L+', '-$Y+', '-$O-', '-V', '-VR'], defines: baseDefines };
|
|
96
|
+
case 'RELEASE':
|
|
97
|
+
return { flags: ['-B', '-$W+', '-$J+', '-$D0', '-$L-', '-$Y-', '-$O+'], defines: releaseDefines };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function buildDependencies(opts) {
|
|
101
|
+
return opts.dependencyPaths.join(';');
|
|
102
|
+
}
|
|
103
|
+
function resolveEnvTemplate(template, envVersion) {
|
|
104
|
+
return template
|
|
105
|
+
.replace(/\$\{envVersion\}/g, envVersion)
|
|
106
|
+
.replace(/\$envVersion/g, envVersion);
|
|
107
|
+
}
|
package/dist/cli/program.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.runCli = runCli;
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const execute_1 = require("../build/execute");
|
|
10
|
+
const validate_commands_1 = require("../build/validate-commands");
|
|
10
11
|
const config_1 = require("../config/config");
|
|
11
12
|
const validate_1 = require("../config/validate");
|
|
12
13
|
const doctor_1 = require("../diagnostics/doctor");
|
|
@@ -175,6 +176,20 @@ async function runCli(argv) {
|
|
|
175
176
|
.command('doctor')
|
|
176
177
|
.description('Diagnostica configuração, paths e binários do ambiente')
|
|
177
178
|
.action(() => (0, doctor_1.runDoctor)(config, resolvedConfigPath)), HELP_EXAMPLES.doctor);
|
|
179
|
+
program
|
|
180
|
+
.command('validate-commands')
|
|
181
|
+
.description('Imprime os comandos que seriam executados (para geração de testes)')
|
|
182
|
+
.option('-t, --type <FAST|DEBUG|RELEASE>', 'Modo de build')
|
|
183
|
+
.option('-p, --project <path>', 'Caminho do projeto')
|
|
184
|
+
.option('-v, --version <version>', 'Versão a injetar')
|
|
185
|
+
.action(async (opts) => {
|
|
186
|
+
const buildType = (opts.type?.toUpperCase() || 'DEBUG');
|
|
187
|
+
const projectPath = opts.project || Object.values(config.projects)[0];
|
|
188
|
+
const version = opts.version || '11.3.0';
|
|
189
|
+
const resolved = await (0, prompts_1.promptBuild)(config, buildType, projectPath, version);
|
|
190
|
+
const projectName = projectPath.split('\\').pop() || projectPath;
|
|
191
|
+
(0, validate_commands_1.printCommands)(resolved, projectName);
|
|
192
|
+
});
|
|
178
193
|
if (argv.length <= 2) {
|
|
179
194
|
(0, output_1.banner)();
|
|
180
195
|
const resolved = await (0, prompts_1.promptBuild)(config);
|
package/dist/config/config.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.DEFAULT_CONFIG = exports.CONFIG_ENV_VAR = exports.LEGACY_CONFIG_FILENAME = exports.CONFIG_FILENAME = void 0;
|
|
37
|
+
exports.resolveLibTemplate = resolveLibTemplate;
|
|
37
38
|
exports.buildDefaultDependencyPaths = buildDefaultDependencyPaths;
|
|
38
39
|
exports.getDefaultConfigPath = getDefaultConfigPath;
|
|
39
40
|
exports.getWritableConfigPath = getWritableConfigPath;
|
|
@@ -46,54 +47,78 @@ const path = __importStar(require("path"));
|
|
|
46
47
|
exports.CONFIG_FILENAME = 'bbuilder.config.json';
|
|
47
48
|
exports.LEGACY_CONFIG_FILENAME = 'bimer.config.json';
|
|
48
49
|
exports.CONFIG_ENV_VAR = 'BBUILDER_CONFIG';
|
|
50
|
+
function resolveLibTemplate(template, libRoot, envVersion) {
|
|
51
|
+
let result = template
|
|
52
|
+
.replace(/\$\{libRoot\}/g, libRoot)
|
|
53
|
+
.replace(/\$libRoot/g, libRoot);
|
|
54
|
+
if (envVersion) {
|
|
55
|
+
result = result
|
|
56
|
+
.replace(/\$\{envVersion\}/g, envVersion)
|
|
57
|
+
.replace(/\$envVersion/g, envVersion);
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
49
61
|
const DEFAULT_CONFIG_BASE = {
|
|
50
62
|
repoBase: 'C:\\git\\bimer',
|
|
51
63
|
delphiDir: 'C:\\Program Files (x86)\\Embarcadero\\Studio\\22.0',
|
|
52
64
|
envVersion: '11.03.00',
|
|
53
|
-
libRoot: 'C:\\LibraryDelphiAlexandria
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
libRoot: 'C:\\LibraryDelphiAlexandria',
|
|
66
|
+
libExternos: '${libRoot}\\Externos\\3.00',
|
|
67
|
+
libErp: '${libRoot}\\ERP\\${envVersion}',
|
|
68
|
+
libAlterdata: '${libRoot}\\LibAlterdata\\1.0.0',
|
|
69
|
+
exeOutputDir: 'C:\\Temp\\${envVersion}\\EXE',
|
|
70
|
+
dcuOutputDir: 'C:\\Temp\\${envVersion}\\DCU',
|
|
56
71
|
};
|
|
57
72
|
function buildDefaultDependencyPaths(params) {
|
|
58
|
-
const { repoBase, delphiDir,
|
|
73
|
+
const { repoBase, delphiDir, libExternos, libErp, libAlterdata } = params;
|
|
59
74
|
return [
|
|
60
75
|
`${repoBase}\\dependencies`,
|
|
61
76
|
`${delphiDir}\\lib\\Win64\\release`,
|
|
62
|
-
`${
|
|
63
|
-
`${
|
|
64
|
-
`${
|
|
65
|
-
`${
|
|
66
|
-
`${
|
|
67
|
-
`${
|
|
68
|
-
`${
|
|
69
|
-
`${
|
|
70
|
-
`${
|
|
71
|
-
`${
|
|
72
|
-
`${
|
|
73
|
-
`${
|
|
74
|
-
`${
|
|
75
|
-
`${
|
|
76
|
-
`${
|
|
77
|
-
`${
|
|
77
|
+
`${libExternos}\\sgcWebSockets\\Win64`,
|
|
78
|
+
`${libExternos}\\DevExpress\\Win64`,
|
|
79
|
+
`${libExternos}\\dataset-serialize\\Win64`,
|
|
80
|
+
`${libExternos}\\UniDAC\\Win64`,
|
|
81
|
+
`${libExternos}\\EurekaLog\\Common`,
|
|
82
|
+
`${libExternos}\\EurekaLog\\Win64`,
|
|
83
|
+
`${libExternos}\\SMImport\\Win64`,
|
|
84
|
+
`${libExternos}\\SMExport\\Win64`,
|
|
85
|
+
`${libExternos}\\RXLibrary\\Win64`,
|
|
86
|
+
`${libExternos}\\ReportBuilder\\Win64`,
|
|
87
|
+
`${libExternos}\\ComPort\\Win64`,
|
|
88
|
+
`${libExternos}\\QuickReport\\Win64`,
|
|
89
|
+
`${libExternos}\\FastMM\\Win64`,
|
|
90
|
+
`${libExternos}\\Tee\\Win64`,
|
|
91
|
+
`${libExternos}\\ExtraDevices\\Win64`,
|
|
92
|
+
`${libExternos}\\ExtraFilter\\Win64`,
|
|
78
93
|
`${libErp}\\Win64`,
|
|
79
|
-
`${
|
|
80
|
-
`${
|
|
81
|
-
`${
|
|
82
|
-
`${
|
|
83
|
-
`${
|
|
94
|
+
`${libExternos}\\ZipForge\\Win64`,
|
|
95
|
+
`${libExternos}\\FortesReport\\Win64`,
|
|
96
|
+
`${libExternos}\\TBGWebCharts\\Win64`,
|
|
97
|
+
`${libExternos}\\EventBus\\Win64`,
|
|
98
|
+
`${libExternos}\\Horse\\Win64`,
|
|
84
99
|
`${libAlterdata}\\feedbacker`,
|
|
85
100
|
`${libAlterdata}\\rest-client`,
|
|
86
101
|
];
|
|
87
102
|
}
|
|
88
103
|
exports.DEFAULT_CONFIG = {
|
|
89
104
|
...DEFAULT_CONFIG_BASE,
|
|
90
|
-
|
|
105
|
+
libExternos: resolveLibTemplate(DEFAULT_CONFIG_BASE.libExternos, DEFAULT_CONFIG_BASE.libRoot),
|
|
106
|
+
libErp: resolveLibTemplate(DEFAULT_CONFIG_BASE.libErp, DEFAULT_CONFIG_BASE.libRoot, DEFAULT_CONFIG_BASE.envVersion),
|
|
107
|
+
libAlterdata: resolveLibTemplate(DEFAULT_CONFIG_BASE.libAlterdata, DEFAULT_CONFIG_BASE.libRoot),
|
|
108
|
+
dependencyPaths: buildDefaultDependencyPaths({
|
|
109
|
+
...DEFAULT_CONFIG_BASE,
|
|
110
|
+
libExternos: resolveLibTemplate(DEFAULT_CONFIG_BASE.libExternos, DEFAULT_CONFIG_BASE.libRoot),
|
|
111
|
+
libErp: resolveLibTemplate(DEFAULT_CONFIG_BASE.libErp, DEFAULT_CONFIG_BASE.libRoot, DEFAULT_CONFIG_BASE.envVersion),
|
|
112
|
+
libAlterdata: resolveLibTemplate(DEFAULT_CONFIG_BASE.libAlterdata, DEFAULT_CONFIG_BASE.libRoot),
|
|
113
|
+
}),
|
|
91
114
|
projects: {
|
|
92
115
|
BimerFaturamento: 'faturamento\\BimerFaturamento',
|
|
93
116
|
Bimer: 'Bimer',
|
|
94
117
|
LiberadorEstoque: 'geral\\gerenteeletronico.jobs.liberadorestoque\\LiberadorEstoque',
|
|
95
118
|
BimerEstoque: 'estoque\\BimerEstoque',
|
|
96
119
|
},
|
|
120
|
+
exeOutputDir: DEFAULT_CONFIG_BASE.exeOutputDir,
|
|
121
|
+
dcuOutputDir: DEFAULT_CONFIG_BASE.dcuOutputDir,
|
|
97
122
|
};
|
|
98
123
|
function deriveProjectName(projectPath) {
|
|
99
124
|
const normalized = projectPath.replace(/[\\/]+$/, '');
|
|
@@ -167,6 +192,17 @@ function loadConfig(configPath) {
|
|
|
167
192
|
...parsed,
|
|
168
193
|
projects: normalizeProjects(parsed.projects),
|
|
169
194
|
};
|
|
195
|
+
const libRoot = merged.libRoot || DEFAULT_CONFIG_BASE.libRoot;
|
|
196
|
+
const envVersion = merged.envVersion || DEFAULT_CONFIG_BASE.envVersion;
|
|
197
|
+
if (parsed.libExternos?.includes('${libRoot}') || !parsed.libExternos) {
|
|
198
|
+
merged.libExternos = resolveLibTemplate(DEFAULT_CONFIG_BASE.libExternos, libRoot);
|
|
199
|
+
}
|
|
200
|
+
if (parsed.libErp?.includes('${libRoot}') || !parsed.libErp) {
|
|
201
|
+
merged.libErp = resolveLibTemplate(DEFAULT_CONFIG_BASE.libErp, libRoot, envVersion);
|
|
202
|
+
}
|
|
203
|
+
if (parsed.libAlterdata?.includes('${libRoot}') || !parsed.libAlterdata) {
|
|
204
|
+
merged.libAlterdata = resolveLibTemplate(DEFAULT_CONFIG_BASE.libAlterdata, libRoot);
|
|
205
|
+
}
|
|
170
206
|
if (!Array.isArray(parsed.dependencyPaths) || parsed.dependencyPaths.length === 0) {
|
|
171
207
|
merged.dependencyPaths = buildDefaultDependencyPaths(merged);
|
|
172
208
|
}
|
package/dist/config/validate.js
CHANGED
|
@@ -73,6 +73,7 @@ function validateConfigObject(raw) {
|
|
|
73
73
|
'delphiDir',
|
|
74
74
|
'envVersion',
|
|
75
75
|
'libRoot',
|
|
76
|
+
'libExternos',
|
|
76
77
|
'libErp',
|
|
77
78
|
'libAlterdata',
|
|
78
79
|
];
|
|
@@ -81,6 +82,15 @@ function validateConfigObject(raw) {
|
|
|
81
82
|
issues.push({ field, message: 'deve ser uma string não vazia' });
|
|
82
83
|
}
|
|
83
84
|
}
|
|
85
|
+
const optionalStringFields = [
|
|
86
|
+
'exeOutputDir',
|
|
87
|
+
'dcuOutputDir',
|
|
88
|
+
];
|
|
89
|
+
for (const field of optionalStringFields) {
|
|
90
|
+
if (config[field] !== undefined && !isNonEmptyString(config[field])) {
|
|
91
|
+
issues.push({ field, message: 'deve ser uma string não vazia se fornecida' });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
84
94
|
if (!Array.isArray(config.dependencyPaths) || config.dependencyPaths.length === 0) {
|
|
85
95
|
issues.push({ field: 'dependencyPaths', message: 'deve ser um array com ao menos um path' });
|
|
86
96
|
}
|
|
@@ -68,6 +68,7 @@ function runDoctor(config, resolvedConfigPath) {
|
|
|
68
68
|
checks.push(checkPath('delphiDir', config.delphiDir));
|
|
69
69
|
checks.push(checkPath('Delphi runtime Win64', delphiRuntimePath));
|
|
70
70
|
checks.push(checkPath('libRoot', config.libRoot));
|
|
71
|
+
checks.push(checkPath('libExternos', config.libExternos));
|
|
71
72
|
checks.push(checkPath('libErp', config.libErp));
|
|
72
73
|
checks.push(checkPath('libAlterdata', config.libAlterdata));
|
|
73
74
|
checks.push(checkFile('cgrc.exe', cgrcPath));
|
package/dist/ui/prompts.js
CHANGED
|
@@ -55,9 +55,12 @@ async function promptBuild(config, cliType, cliProject, cliVersion) {
|
|
|
55
55
|
delphiDir: config.delphiDir,
|
|
56
56
|
envVersion: config.envVersion,
|
|
57
57
|
libRoot: config.libRoot,
|
|
58
|
+
libExternos: config.libExternos,
|
|
58
59
|
libErp: config.libErp,
|
|
59
60
|
libAlterdata: config.libAlterdata,
|
|
60
61
|
dependencyPaths: config.dependencyPaths,
|
|
62
|
+
exeOutputDir: config.exeOutputDir,
|
|
63
|
+
dcuOutputDir: config.dcuOutputDir,
|
|
61
64
|
};
|
|
62
65
|
}
|
|
63
66
|
async function runConfigInit(config, configPath) {
|
|
@@ -70,18 +73,27 @@ async function runConfigInit(config, configPath) {
|
|
|
70
73
|
{ type: 'input', name: 'envVersion', message: 'Versão do ambiente (ENV):', default: config.envVersion },
|
|
71
74
|
{ type: 'input', name: 'libRoot', message: 'LibraryDelphiAlexandria root:', default: config.libRoot },
|
|
72
75
|
]);
|
|
73
|
-
const
|
|
76
|
+
const libRoot = answers.libRoot || 'C:\\LibraryDelphiAlexandria';
|
|
77
|
+
const libExternosTemplate = answers.libExternos || '${libRoot}\\Externos\\3.00';
|
|
78
|
+
const libErpTemplate = answers.libErp || '${libRoot}\\ERP\\${envVersion}';
|
|
79
|
+
const libAlterdataTemplate = answers.libAlterdata || '${libRoot}\\LibAlterdata\\1.0.0';
|
|
80
|
+
const exeOutputDir = answers.exeOutputDir || 'C:\\Temp\\${envVersion}\\EXE';
|
|
81
|
+
const dcuOutputDir = answers.dcuOutputDir || 'C:\\Temp\\${envVersion}\\DCU';
|
|
74
82
|
const newConfig = {
|
|
75
83
|
...config,
|
|
76
84
|
...answers,
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
libRoot,
|
|
86
|
+
libExternos: libExternosTemplate,
|
|
87
|
+
libErp: libErpTemplate,
|
|
88
|
+
libAlterdata: libAlterdataTemplate,
|
|
89
|
+
exeOutputDir,
|
|
90
|
+
dcuOutputDir,
|
|
79
91
|
dependencyPaths: (0, config_1.buildDefaultDependencyPaths)({
|
|
80
92
|
repoBase: answers.repoBase,
|
|
81
93
|
delphiDir: answers.delphiDir,
|
|
82
|
-
|
|
83
|
-
libErp,
|
|
84
|
-
libAlterdata:
|
|
94
|
+
libExternos: (0, config_1.resolveLibTemplate)(libExternosTemplate, libRoot),
|
|
95
|
+
libErp: (0, config_1.resolveLibTemplate)(libErpTemplate, libRoot, answers.envVersion),
|
|
96
|
+
libAlterdata: (0, config_1.resolveLibTemplate)(libAlterdataTemplate, libRoot),
|
|
85
97
|
}),
|
|
86
98
|
};
|
|
87
99
|
(0, config_1.saveConfig)(newConfig, configPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brunoluizdesiqueira/bbuilder-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"description": "CLI de build local para projetos Delphi do Bimer",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "tsc",
|
|
35
35
|
"dev": "ts-node src/index.ts",
|
|
36
|
-
"test": "
|
|
36
|
+
"test": "node --test test/**/*.test.ts",
|
|
37
37
|
"prepack": "npm run build",
|
|
38
38
|
"changeset": "changeset",
|
|
39
39
|
"version-packages": "changeset version",
|