entexto-cli 1.4.0 → 1.4.2

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.
@@ -236,10 +236,13 @@ module.exports = async function sync(options) {
236
236
  const { ruta } = data || {};
237
237
  if (!ruta) return;
238
238
  const destFile = path.join(absDir, ruta);
239
+ // ⚠️ El guard DEBE ponerse ANTES de unlinkSync porque chokidar
240
+ // detecta el 'unlink' síncronamente y dispararía eliminarArchivoRemoto
241
+ // antes de que el guard estuviera listo (race condition).
242
+ localDeletedAt.set(ruta, Date.now());
239
243
  try {
240
244
  if (fs.existsSync(destFile)) {
241
245
  fs.unlinkSync(destFile);
242
- localDeletedAt.set(ruta, Date.now());
243
246
  console.log(' ' + chalk.red('✖') + ' ' + chalk.white(ruta) + chalk.gray(' ← borrado remoto'));
244
247
  }
245
248
  } catch { console.log(' ' + chalk.red('✖') + ' No se pudo borrar: ' + ruta); }
@@ -251,12 +254,13 @@ module.exports = async function sync(options) {
251
254
  const oldFile = path.join(absDir, ruta_antigua);
252
255
  const newFile = path.join(absDir, ruta_nueva);
253
256
  const newDir = path.dirname(newFile);
257
+ // ⚠️ Guards ANTES de renameSync por el mismo motivo (race con chokidar).
258
+ localDeletedAt.set(ruta_antigua, Date.now());
259
+ localUploadedAt.set(ruta_nueva, Date.now());
254
260
  try {
255
261
  if (fs.existsSync(oldFile)) {
256
262
  if (!fs.existsSync(newDir)) fs.mkdirSync(newDir, { recursive: true });
257
263
  fs.renameSync(oldFile, newFile);
258
- localDeletedAt.set(ruta_antigua, Date.now());
259
- localUploadedAt.set(ruta_nueva, Date.now());
260
264
  console.log(' ' + chalk.yellow('↔') + ' ' + chalk.white(ruta_antigua) + chalk.gray(' → ') + chalk.white(ruta_nueva));
261
265
  }
262
266
  } catch { console.log(' ' + chalk.red('✖') + ' No se pudo renombrar: ' + ruta_antigua); }
package/lib/utils/api.js CHANGED
@@ -79,11 +79,11 @@ async function streamEvents(uuid, onEvent) {
79
79
  });
80
80
  const stream = response.data;
81
81
  let buffer = '';
82
+ let eventType = 'message', dataStr = '';
82
83
  stream.on('data', (chunk) => {
83
84
  buffer += chunk.toString();
84
85
  const parts = buffer.split('\n');
85
86
  buffer = parts.pop();
86
- let eventType = 'message', dataStr = '';
87
87
  for (const line of parts) {
88
88
  if (line.startsWith('event: ')) eventType = line.slice(7).trim();
89
89
  else if (line.startsWith('data: ')) dataStr = line.slice(6).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entexto-cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "CLI oficial de Entexto — Deploy y gestión de proyectos desde tu terminal",
5
5
  "main": "lib/index.js",
6
6
  "bin": {