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 +38 -8
- package/dist/templates/default/bun.lock +1 -1
- package/package.json +1 -1
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.
|
|
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
|
|
222
|
+
let previous = [];
|
|
223
|
+
let columns = process.stdout.columns;
|
|
223
224
|
let started;
|
|
224
225
|
let timer;
|
|
225
226
|
function render() {
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
232
|
-
|
|
261
|
+
process.stdout.write(frame.join(`
|
|
262
|
+
`) + `
|
|
233
263
|
`);
|
|
234
|
-
|
|
235
|
-
|
|
264
|
+
previous = frame;
|
|
265
|
+
columns = process.stdout.columns;
|
|
236
266
|
}
|
|
237
267
|
if (live)
|
|
238
268
|
render();
|