mozhost-cli 1.3.0 → 2.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/package.json +1 -1
- package/src/commands/deploy.js +21 -1
package/package.json
CHANGED
package/src/commands/deploy.js
CHANGED
|
@@ -317,7 +317,7 @@ function shouldIgnore(filePath, patterns) {
|
|
|
317
317
|
return false;
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
/*
|
|
321
321
|
async function uploadFiles(containerId, projectDir, files, spinner) {
|
|
322
322
|
const client = await api.getClient();
|
|
323
323
|
const baseURL = await config.getApiUrl();
|
|
@@ -341,6 +341,26 @@ async function uploadFiles(containerId, projectDir, files, spinner) {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
+
*/
|
|
345
|
+
|
|
346
|
+
async function uploadFiles(containerId, projectDir, files, spinner) {
|
|
347
|
+
// Enviar em lotes para evitar timeout
|
|
348
|
+
const BATCH_SIZE = 20;
|
|
349
|
+
|
|
350
|
+
for (let i = 0; i < files.length; i += BATCH_SIZE) {
|
|
351
|
+
const batch = files.slice(i, i + BATCH_SIZE);
|
|
352
|
+
|
|
353
|
+
spinner.text = `Upload: ${Math.min(i + BATCH_SIZE, files.length)}/${files.length} arquivos...`;
|
|
354
|
+
|
|
355
|
+
for (const file of batch) {
|
|
356
|
+
const fullPath = path.join(projectDir, file);
|
|
357
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
358
|
+
|
|
359
|
+
// Usar o método correto do api.js que chama o endpoint /cli-upload
|
|
360
|
+
await api.uploadFile(containerId, file, content);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
344
364
|
|
|
345
365
|
module.exports = {
|
|
346
366
|
init,
|