create-disposabl-app 0.1.2 → 0.1.3

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/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
8
8
  import { Command, CommanderError } from "commander";
9
9
  import * as p2 from "@clack/prompts";
10
10
  // package.json
11
- var version = "0.1.2";
11
+ var version = "0.1.3";
12
12
 
13
13
  // options.ts
14
14
  var platforms = [
@@ -219,20 +219,50 @@ function setupTable(name, config, status, columns = 80) {
219
219
  function projectSetup(name, config) {
220
220
  const live = Boolean(process.stdout.isTTY);
221
221
  const status = { installation: "Pending" };
222
- let lines = 0;
222
+ let previous = [];
223
+ let columns = process.stdout.columns;
223
224
  let started;
224
225
  let timer;
225
226
  function render() {
226
- if (live && lines) {
227
- moveCursor(process.stdout, 0, -lines);
227
+ const frame = setupTable(name, config, status, process.stdout.columns).split(`
228
+ `);
229
+ if (live && previous.length === frame.length && columns === process.stdout.columns) {
230
+ let update = "";
231
+ for (let row = 0;row < frame.length; row++) {
232
+ const before = previous[row];
233
+ const after = frame[row];
234
+ if (before === after)
235
+ continue;
236
+ let start = 0;
237
+ let end = after.length;
238
+ if (before.length === after.length && !before.includes("\x1B") && !after.includes("\x1B")) {
239
+ while (start < end && before[start] === after[start])
240
+ start++;
241
+ while (end > start && before[end - 1] === after[end - 1])
242
+ end--;
243
+ }
244
+ const distance = frame.length - row;
245
+ update += `\x1B[${distance}A\x1B[${start + 1}G`;
246
+ if (start === 0)
247
+ update += "\x1B[2K";
248
+ update += after.slice(start, end);
249
+ update += `\x1B[${distance}B\x1B[1G`;
250
+ }
251
+ if (update)
252
+ process.stdout.write(update);
253
+ previous = frame;
254
+ return;
255
+ }
256
+ if (live && previous.length) {
257
+ moveCursor(process.stdout, 0, -previous.length);
228
258
  cursorTo(process.stdout, 0);
229
259
  clearScreenDown(process.stdout);
230
260
  }
231
- const frame = setupTable(name, config, status, process.stdout.columns);
232
- process.stdout.write(frame + `
261
+ process.stdout.write(frame.join(`
262
+ `) + `
233
263
  `);
234
- lines = frame.split(`
235
- `).length;
264
+ previous = frame;
265
+ columns = process.stdout.columns;
236
266
  }
237
267
  if (live)
238
268
  render();
@@ -130,7 +130,7 @@
130
130
  },
131
131
  "packages/create-disposabl-app": {
132
132
  "name": "create-disposabl-app",
133
- "version": "0.1.2",
133
+ "version": "0.1.3",
134
134
  "bin": {
135
135
  "create-disposabl-app": "dist/index.js",
136
136
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",