create-canaima-app 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/index.js +15 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -49,28 +49,30 @@ class CoatiAnimator {
49
49
  this.interval = null;
50
50
  this.frame = 0;
51
51
  this.msgIndex = 0;
52
- this.linesDrawn = 0;
52
+ this.isAnimating = false;
53
53
  process.stdout.write('\x1b[?25l'); // Ocultar cursor
54
54
  }
55
55
 
56
56
  clear() {
57
- if (this.linesDrawn > 0) {
58
- readline.moveCursor(process.stdout, 0, -this.linesDrawn);
57
+ if (this.isAnimating) {
58
+ // Como ya NO imprimimos un salto de línea al final, el cursor
59
+ // está en la última línea dibujada. Solo necesitamos subir 2 líneas.
60
+ readline.moveCursor(process.stdout, 0, -2);
61
+ readline.cursorTo(process.stdout, 0);
59
62
  readline.clearScreenDown(process.stdout);
60
63
  }
61
- this.linesDrawn = 0;
62
64
  }
63
65
 
64
66
  start() {
65
67
  this.render();
68
+ this.isAnimating = true;
66
69
  this.interval = setInterval(() => {
67
70
  this.frame++;
68
- // Cambiar de frase cada 15 frames
69
71
  if (this.frame % 15 === 0) {
70
72
  this.msgIndex = (this.msgIndex + 1) % this.messages.length;
71
73
  }
72
74
  this.render();
73
- }, 250); // Velocidad de la animación
75
+ }, 250);
74
76
  }
75
77
 
76
78
  render(isFinal = false, finalMessage = null) {
@@ -91,16 +93,19 @@ class CoatiAnimator {
91
93
  ` ` + c.dim(`╰${line}╯`)
92
94
  ];
93
95
 
94
- process.stdout.write(out.join('\n') + '\n');
95
- this.linesDrawn = 3;
96
+ // ATENCIÓN: Imprimimos con .join('\n') pero SIN añadir un '\n' al final.
97
+ // Esto evita que la terminal haga scroll automático.
98
+ process.stdout.write(out.join('\n'));
99
+ this.isAnimating = true;
96
100
  }
97
101
 
98
102
  stop(finalMessage = null) {
99
103
  if (this.interval) clearInterval(this.interval);
100
- process.stdout.write('\x1b[?25h'); // Mostrar cursor
104
+ process.stdout.write('\x1b[?25h'); // Mostrar cursor nuevamente
101
105
 
102
106
  this.render(true, finalMessage);
103
- console.log();
107
+ console.log('\n'); // Damos el salto de línea al final, cuando ya terminó
108
+ this.isAnimating = false;
104
109
  }
105
110
  }
106
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-canaima-app",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLI para scaffolding de proyectos de escritorio con Tauri, Vue 3 y Rust.",
5
5
  "main": "index.js",
6
6
  "type": "module",