@dbcube/cli 5.2.8 → 5.2.10
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/package.json +3 -3
- package/src/index.js +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbcube/cli",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.10",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dbcube": "node src/index.js"
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dbcube/schema-builder": "^5.2.
|
|
31
|
+
"@dbcube/schema-builder": "^5.2.10",
|
|
32
32
|
"@inquirer/prompts": "^8.5.2",
|
|
33
33
|
"alwait": "^1.0.0",
|
|
34
34
|
"chalk": "4.1.2",
|
|
35
|
-
"dbcube": "^5.2.
|
|
35
|
+
"dbcube": "^5.2.10",
|
|
36
36
|
"dotenv": "^17.4.2",
|
|
37
37
|
"fs-extra": "^11.3.5",
|
|
38
38
|
"glob": "^13.0.6",
|
package/src/index.js
CHANGED
|
@@ -118,6 +118,28 @@ function suggestCommand(input) {
|
|
|
118
118
|
.map(s => s.display);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
// Comandos que NO tocan los engines (no necesitan binarios).
|
|
122
|
+
const NO_ENGINE_COMMANDS = new Set([
|
|
123
|
+
'help', '--help', '-h', 'version', '--version', '-v',
|
|
124
|
+
'validate', 'generate', 'init',
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
// Pre-descarga los binarios de los engines ANTES de ejecutar el comando, para
|
|
128
|
+
// que su UI (spinner + barras de progreso, ambas en paralelo) se complete y NO
|
|
129
|
+
// se solape con la salida del comando. Si ya están presentes, retorna al
|
|
130
|
+
// instante. Best-effort: si algo falla, el comando los descargará igual.
|
|
131
|
+
async function ensureEnginesReady(command) {
|
|
132
|
+
if (NO_ENGINE_COMMANDS.has(command) || command === 'update' || command === 'run:download') {
|
|
133
|
+
return; // estos no usan engine, o gestionan su propia descarga
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const { Binary } = require('@dbcube/core');
|
|
137
|
+
await Binary.ensureBinariesExist();
|
|
138
|
+
} catch {
|
|
139
|
+
// core no resoluble o fallo de red: el comando reintentará la descarga.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
121
143
|
// Función para ejecutar comandos basados en los argumentos
|
|
122
144
|
async function executeCommand(command, commandArgs) {
|
|
123
145
|
if (commandMap[command]) {
|
|
@@ -126,6 +148,7 @@ async function executeCommand(command, commandArgs) {
|
|
|
126
148
|
|
|
127
149
|
try {
|
|
128
150
|
process.argv = [process.argv[0], process.argv[1], ...commandArgs];
|
|
151
|
+
await ensureEnginesReady(command);
|
|
129
152
|
await require(examplePath);
|
|
130
153
|
} finally {
|
|
131
154
|
process.argv = originalArgv;
|