@gridland/demo 0.2.12 → 0.2.15
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/bin/cli.mjs +21 -3
- package/dist/chunk-R3ENBVV6.js +2140 -0
- package/dist/chunk-SQ5UVJ3G.js +2146 -0
- package/dist/demo-names.json +1 -1
- package/dist/landing.js +6 -0
- package/dist/run.js +412 -1676
- package/package.json +6 -1
package/bin/cli.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
|
|
@@ -17,7 +18,7 @@ if (!name || name === "--help" || name === "-h") {
|
|
|
17
18
|
console.log(` ${d}`);
|
|
18
19
|
}
|
|
19
20
|
console.log("\nExamples:");
|
|
20
|
-
console.log("
|
|
21
|
+
console.log(" bunx @gridland/demo ascii");
|
|
21
22
|
console.log(" bunx @gridland/demo gradient");
|
|
22
23
|
process.exit(name ? 0 : 1);
|
|
23
24
|
}
|
|
@@ -28,5 +29,22 @@ if (!AVAILABLE_DEMOS.includes(name)) {
|
|
|
28
29
|
process.exit(1);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
// @opentui/core uses bun:ffi for the native terminal renderer, so we must run under bun
|
|
33
|
+
let hasBun = false;
|
|
34
|
+
try {
|
|
35
|
+
execSync("bun --version", { stdio: "ignore" });
|
|
36
|
+
hasBun = true;
|
|
37
|
+
} catch {}
|
|
38
|
+
|
|
39
|
+
if (!hasBun) {
|
|
40
|
+
console.error("Error: bun is required to run gridland demos.");
|
|
41
|
+
console.error("Install it with: curl -fsSL https://bun.sh/install | bash");
|
|
42
|
+
console.error("\nThen run: bunx @gridland/demo " + name);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const runPath = join(__dirname, "../dist/run.js");
|
|
47
|
+
const { status } = spawnSync("bun", ["-e", `import("${runPath}").then(m => m.runDemo("${name}"))`], {
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
});
|
|
50
|
+
process.exit(status ?? 1);
|