-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·108 lines (101 loc) · 3.99 KB
/
index.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env node
"use strict";
const chalk = require("chalk");
const shrek = [
"⢀⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ",
"⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀⠀⠀⢀⢴⣶⣆ ",
"⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦⣴⣾⠁⠸⣼⡿ ",
"⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟⠉⠀⠀⠀⠀⠀ ",
"⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ",
"⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣶⣮⣭⣽⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ",
"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⠿⠿⠿⠿⠛⠉ "
];
// .join("|\n");
const defaultValues = {
"name": "Sylber",
"github": "Bertrand2",
"linkedin": "bertrand-dossogne/",
"npm":"~sylber",
"card": "@sylber/card"
};
const intro = {
"github": "GitHub : ",
"linkedin": "LinkedIn : ",
"npm": "npm : ",
"card": "Card : "
}
const prefixes = {
"github": "https://github.com/",
"linkedin": "https://linkedin.com/in/",
"npm": "https://npmjs.com/",
"card": "npx "
};
const values = defaultValues;
const cardWidth = 70;
const leftWidth = 20;
const rightWidth = cardWidth - leftWidth;
const createCard = (card) => {
card.push( chalk.black("╔" + "═".repeat(cardWidth) + "╗") );
card.push(
chalk.black("║") +
" ".repeat( Math.floor((cardWidth-values.name.length)/2) ) +
chalk.bold.dim.rgb(20,100,20)(values.name) +
" ".repeat( Math.ceil((cardWidth-values.name.length)/2) ) +
chalk.black("║")
);
card.push( chalk.black("╟" + "─".repeat(cardWidth) + "╢") );
card.push( chalk.black("║" + " ".repeat(cardWidth) + "║") );
card.push(
chalk.black("║") +
" ".repeat( leftWidth-intro.github.length ) +
chalk.bold.black(intro.github) +
chalk.gray(prefixes.github) +
chalk.rgb(100,20,20)(values.github) +
" ".repeat( rightWidth - prefixes.github.length - values.github.length ) +
chalk.black("║")
);
card.push(
chalk.black("║") +
" ".repeat( leftWidth-intro.linkedin.length ) +
chalk.bold.black(intro.linkedin) +
chalk.gray(prefixes.linkedin) +
chalk.rgb(20,20,100)(values.linkedin) +
" ".repeat( rightWidth - prefixes.linkedin.length - values.linkedin.length ) +
chalk.black("║")
);
card.push(
chalk.black("║") +
" ".repeat( leftWidth-intro.npm.length ) +
chalk.bold.black(intro.npm) +
chalk.gray(prefixes.npm) +
chalk.rgb(100,20,100)(values.npm) +
" ".repeat( rightWidth - prefixes.npm.length - values.npm.length ) +
chalk.black("║")
);
card.push(
chalk.black("║") +
" ".repeat( leftWidth-intro.card.length ) +
chalk.bold.black(intro.card) +
chalk.gray(prefixes.card) +
chalk.rgb(20,100,20)(values.card) +
" ".repeat( rightWidth - prefixes.card.length - values.card.length ) +
chalk.black("║")
);
card.push( chalk.black("║" + " ".repeat(cardWidth) + "║") );
card.push( chalk.black("╚" + "═".repeat(cardWidth) + "╝") );
return card;
}
const createFullCard = (image) => {
const card = createCard(["",""]);
const fullCard = image.map( (line, i) => `${chalk.green(line)} ${card[i] ? chalk.bgWhite(card[i]) : ""}`);
return fullCard;
}
console.log(createFullCard(shrek).join("\n"));