create-businessdash 0.1.0 → 0.1.1
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.mjs +114 -32
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1780,46 +1780,129 @@ function rainbow(lines, phase, depth) {
|
|
|
1780
1780
|
return current ? `${out}\x1B[39m` : out;
|
|
1781
1781
|
});
|
|
1782
1782
|
}
|
|
1783
|
-
var
|
|
1784
|
-
var
|
|
1785
|
-
var
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1783
|
+
var FRAME_MS = 100;
|
|
1784
|
+
var DEGREES_PER_FRAME = 5;
|
|
1785
|
+
var ESC3 = "\x1B";
|
|
1786
|
+
function rowsMoved(chunk) {
|
|
1787
|
+
let rows = 0;
|
|
1788
|
+
for (let i2 = 0; i2 < chunk.length; i2++) {
|
|
1789
|
+
const c3 = chunk[i2];
|
|
1790
|
+
if (c3 === "\n") {
|
|
1791
|
+
rows++;
|
|
1792
|
+
continue;
|
|
1793
|
+
}
|
|
1794
|
+
if (c3 !== ESC3) continue;
|
|
1795
|
+
const next = chunk[i2 + 1];
|
|
1796
|
+
if (next === "8" || next === "M" || next === "c") return Number.NaN;
|
|
1797
|
+
if (next !== "[") continue;
|
|
1798
|
+
let j = i2 + 2;
|
|
1799
|
+
let params = "";
|
|
1800
|
+
while (j < chunk.length && /[0-9;?]/.test(chunk[j] ?? "")) {
|
|
1801
|
+
params += chunk[j];
|
|
1802
|
+
j++;
|
|
1803
|
+
}
|
|
1804
|
+
const n3 = Number.parseInt(params, 10) || 1;
|
|
1805
|
+
switch (chunk[j]) {
|
|
1806
|
+
case "A":
|
|
1807
|
+
case "F":
|
|
1808
|
+
rows -= n3;
|
|
1809
|
+
break;
|
|
1810
|
+
case "B":
|
|
1811
|
+
case "E":
|
|
1812
|
+
rows += n3;
|
|
1813
|
+
break;
|
|
1814
|
+
case "H":
|
|
1815
|
+
case "f":
|
|
1816
|
+
case "S":
|
|
1817
|
+
case "T":
|
|
1818
|
+
case "u":
|
|
1819
|
+
return Number.NaN;
|
|
1820
|
+
case "J":
|
|
1821
|
+
if (params === "2" || params === "3") return Number.NaN;
|
|
1822
|
+
break;
|
|
1823
|
+
}
|
|
1824
|
+
i2 = j;
|
|
1825
|
+
}
|
|
1826
|
+
return rows;
|
|
1827
|
+
}
|
|
1828
|
+
var every = (tick, ms) => {
|
|
1829
|
+
const timer = setInterval(tick, ms);
|
|
1830
|
+
timer.unref?.();
|
|
1831
|
+
return () => clearInterval(timer);
|
|
1832
|
+
};
|
|
1833
|
+
function showLogo(out, options = {}) {
|
|
1834
|
+
const idle = { stop() {
|
|
1835
|
+
} };
|
|
1836
|
+
const env = options.env ?? process.env;
|
|
1789
1837
|
const lines = out.isTTY ? logoLines(out.columns) : null;
|
|
1790
|
-
if (!lines) return;
|
|
1838
|
+
if (!lines) return idle;
|
|
1791
1839
|
const depth = colorDepth(env);
|
|
1792
1840
|
if (depth === "none") {
|
|
1793
1841
|
out.write(`
|
|
1794
1842
|
${lines.join("\n")}
|
|
1795
1843
|
|
|
1796
1844
|
`);
|
|
1797
|
-
return;
|
|
1845
|
+
return idle;
|
|
1798
1846
|
}
|
|
1799
|
-
const frame = (
|
|
1847
|
+
const frame = (n4) => rainbow(lines, n4 * DEGREES_PER_FRAME, depth);
|
|
1800
1848
|
out.write(`
|
|
1801
|
-
${frame(0)}
|
|
1802
|
-
|
|
1803
|
-
if (!env.CI && (out.rows ?? 0) > lines.length + 1) {
|
|
1804
|
-
const interrupted = () => {
|
|
1805
|
-
out.write(`${SHOW_CURSOR}
|
|
1806
|
-
`);
|
|
1807
|
-
process.exit(130);
|
|
1808
|
-
};
|
|
1809
|
-
process.once("SIGINT", interrupted);
|
|
1810
|
-
out.write(HIDE_CURSOR);
|
|
1811
|
-
try {
|
|
1812
|
-
for (let n3 = 1; n3 <= FRAMES; n3++) {
|
|
1813
|
-
await wait(FRAME_MS);
|
|
1814
|
-
out.write(`\x1B[${lines.length}A\r${frame(n3)}
|
|
1849
|
+
${frame(0).join("\n")}
|
|
1850
|
+
|
|
1815
1851
|
`);
|
|
1852
|
+
if (env.CI || (out.rows ?? 0) <= lines.length + 2) return idle;
|
|
1853
|
+
let below = 2;
|
|
1854
|
+
let stopped = false;
|
|
1855
|
+
const watched = [out, options.alsoWatch].filter(
|
|
1856
|
+
(t2) => !!t2?.isTTY
|
|
1857
|
+
);
|
|
1858
|
+
const originals = watched.map((t2) => t2.write);
|
|
1859
|
+
const hooks = watched.map((t2, k) => {
|
|
1860
|
+
const original = originals[k];
|
|
1861
|
+
const hook = (chunk, ...rest) => {
|
|
1862
|
+
if (!stopped) {
|
|
1863
|
+
const moved = rowsMoved(
|
|
1864
|
+
typeof chunk === "string" ? chunk : Buffer.from(chunk).toString()
|
|
1865
|
+
);
|
|
1866
|
+
if (Number.isNaN(moved)) stop();
|
|
1867
|
+
else below += moved;
|
|
1816
1868
|
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1869
|
+
return original.call(
|
|
1870
|
+
t2,
|
|
1871
|
+
chunk,
|
|
1872
|
+
...rest
|
|
1873
|
+
);
|
|
1874
|
+
};
|
|
1875
|
+
t2.write = hook;
|
|
1876
|
+
return hook;
|
|
1877
|
+
});
|
|
1878
|
+
const draw = originals[0];
|
|
1879
|
+
let n3 = 0;
|
|
1880
|
+
const tick = () => {
|
|
1881
|
+
if (stopped || below < 1 || below + lines.length > (out.rows ?? 0)) {
|
|
1882
|
+
stop();
|
|
1883
|
+
return;
|
|
1820
1884
|
}
|
|
1885
|
+
n3 = (n3 + 1) % (360 / DEGREES_PER_FRAME);
|
|
1886
|
+
const rows = frame(n3);
|
|
1887
|
+
let chunk = `${ESC3}7${ESC3}[${below + lines.length - 1}A\r`;
|
|
1888
|
+
rows.forEach((row, k) => {
|
|
1889
|
+
chunk += k === 0 ? row : `${ESC3}[1B\r${row}`;
|
|
1890
|
+
});
|
|
1891
|
+
draw.call(out, `${chunk}${ESC3}8`);
|
|
1892
|
+
};
|
|
1893
|
+
const cancel2 = (options.schedule ?? every)(tick, FRAME_MS);
|
|
1894
|
+
const onResize = () => stop();
|
|
1895
|
+
out.on?.("resize", onResize);
|
|
1896
|
+
function stop() {
|
|
1897
|
+
if (stopped) return;
|
|
1898
|
+
stopped = true;
|
|
1899
|
+
cancel2();
|
|
1900
|
+
out.off?.("resize", onResize);
|
|
1901
|
+
watched.forEach((t2, k) => {
|
|
1902
|
+
if (t2.write === hooks[k]) t2.write = originals[k];
|
|
1903
|
+
});
|
|
1821
1904
|
}
|
|
1822
|
-
|
|
1905
|
+
return { stop };
|
|
1823
1906
|
}
|
|
1824
1907
|
|
|
1825
1908
|
// src/keys.ts
|
|
@@ -3443,7 +3526,7 @@ async function main() {
|
|
|
3443
3526
|
return;
|
|
3444
3527
|
}
|
|
3445
3528
|
if (argv.version) {
|
|
3446
|
-
console.log("0.1.
|
|
3529
|
+
console.log("0.1.1");
|
|
3447
3530
|
return;
|
|
3448
3531
|
}
|
|
3449
3532
|
const interactive = argv.interactive ?? Boolean(process.stdin.isTTY);
|
|
@@ -3471,10 +3554,8 @@ async function main() {
|
|
|
3471
3554
|
"--apple-team: an Apple team ID is 10 capital letters and digits (Xcode > Settings > Accounts, or developer.apple.com > Membership)."
|
|
3472
3555
|
);
|
|
3473
3556
|
}
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
intro(import_picocolors2.default.inverse(" create-businessdash "));
|
|
3477
|
-
}
|
|
3557
|
+
const logo = interactive ? showLogo(process.stdout, { alsoWatch: process.stderr }) : void 0;
|
|
3558
|
+
if (interactive) intro(import_picocolors2.default.inverse(" create-businessdash "));
|
|
3478
3559
|
const positional = argv._[0];
|
|
3479
3560
|
let targetDir = positional === void 0 ? "" : formatTargetDir(String(positional));
|
|
3480
3561
|
if (!targetDir) {
|
|
@@ -3565,6 +3646,7 @@ async function main() {
|
|
|
3565
3646
|
}
|
|
3566
3647
|
}
|
|
3567
3648
|
const appleTeam = await chooseAppleTeam(templates, interactive);
|
|
3649
|
+
logo?.stop();
|
|
3568
3650
|
const written = apps.map((app) => {
|
|
3569
3651
|
const dir = app.folder ? join5(root, app.folder) : root;
|
|
3570
3652
|
const name = app.folder ? toValidPackageName(`${packageName}-${app.folder}`) : packageName;
|