-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbanner.ts
More file actions
33 lines (26 loc) · 1 KB
/
banner.ts
File metadata and controls
33 lines (26 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { createRequire } from "node:module";
import chalk from "chalk";
// ESM has no require() — createRequire builds one anchored to this file's location
const _require = createRequire(import.meta.url);
export function getVersion(): string {
for (const p of ["../../package.json", "../package.json"]) {
try {
return _require(p).version;
} catch {}
}
return "0.0.0";
}
const BANNER = [
"╔═╗╦ ╦╔═╗╔╦╗ ╔═╗╔═╗╦═╗╔═╗╔═╗╔═╗",
" ║║ ║╚═╗ ║ ═══╚═╗║ ╠╦╝╠═╣╠═╝║╣ ",
"╚═╝╚═╝╚═╝ ╩ ╚═╝╚═╝╩╚═╩ ╩╩ ╚═╝",
];
const TAGLINE = " made with ♥ from scrapegraphai team";
const BANNER_COLOR = "#bd93f9";
export function showBanner() {
const text = BANNER.map((line) => chalk.hex(BANNER_COLOR)(line)).join("\n");
console.log(text);
console.log(chalk.hex(BANNER_COLOR)(TAGLINE));
console.log(chalk.hex(BANNER_COLOR)(`v${getVersion()}`));
console.log();
}