@reepl/cli 0.1.0

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.
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Prints the branded Reepl screen when the CLI is installed ("on downloading it").
4
+ * Self-contained (no build-output dependency) and never fails the install.
5
+ */
6
+ import { readFile } from "node:fs/promises";
7
+ import { fileURLToPath } from "node:url";
8
+ import { dirname, join } from "node:path";
9
+
10
+ const BRAND = "\x1b[38;2;109;66;204m"; // #6d42cc
11
+ const DIM = "\x1b[2m";
12
+ const RESET = "\x1b[0m";
13
+
14
+ const WORDMARK = [
15
+ "██████╗ ███████╗███████╗██████╗ ██╗ ",
16
+ "██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ",
17
+ "██████╔╝█████╗ █████╗ ██████╔╝██║ ",
18
+ "██╔══██╗██╔══╝ ██╔══╝ ██╔═══╝ ██║ ",
19
+ "██║ ██║███████╗███████╗██║ ███████╗",
20
+ "╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚══════╝",
21
+ ];
22
+
23
+ async function main() {
24
+ // Be polite in automated environments.
25
+ if (process.env.CI || process.env.REEPL_NO_BANNER) return;
26
+
27
+ const color = !process.env.NO_COLOR;
28
+ const p = (s) => (color ? BRAND + s + RESET : s);
29
+ const d = (s) => (color ? DIM + s + RESET : s);
30
+
31
+ let version = "";
32
+ try {
33
+ const here = dirname(fileURLToPath(import.meta.url));
34
+ const pkg = JSON.parse(await readFile(join(here, "..", "package.json"), "utf8"));
35
+ version = pkg.version ? ` v${pkg.version}` : "";
36
+ } catch {
37
+ // ignore
38
+ }
39
+
40
+ const out = [
41
+ "",
42
+ ...WORDMARK.map(p),
43
+ p(" ✦ · ✦"),
44
+ "",
45
+ ` ${p("Reepl CLI")}${d(version)} installed. Your content workflow, in the terminal.`,
46
+ ` ${d("LinkedIn · X · Reddit · carousels · signals · writing styles")}`,
47
+ "",
48
+ ` ${d("Next:")} reepl login ${d("·")} reepl --help`,
49
+ "",
50
+ ].join("\n");
51
+ process.stdout.write(out + "\n");
52
+ }
53
+
54
+ main().catch(() => {
55
+ // Never break `npm install` over a banner.
56
+ });