-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
65 lines (54 loc) · 1.41 KB
/
build.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
const chalk = require("chalk");
const boxen = require("boxen");
const fs = require("fs");
const accentColor = "#ef82ff";
const mainColor = "#efa";
const linkColor = "#cba";
const mainChalk = chalk.hex(mainColor);
const accentChalk = chalk.hex(accentColor);
const linkChalk = chalk.hex(linkColor);
const generateLinks = () => {
const links = {
GitHub: "https://github.com/102",
npm: "https://npmjs.com/~3",
Twitter: "https://twitter.com/9z3",
Email: "rgusev2@gmail.com",
LinkedIn: "https://linkedin.com/in/gusev-roman"
};
const entries = Object.entries(links);
const maxKey = entries.reduce(
(max, [{ length }]) => (max < length ? length : max),
0
);
return entries
.map(([key, value]) => {
return [mainChalk(key.padStart(maxKey)), linkChalk(value)].join(": ");
})
.join("\n");
};
const links = generateLinks();
const maxLink = links
.split("\n")
.reduce((max, { length }) => (max < length ? length : max), 0);
const headingParts = {
name: "Roman Gusev",
separator: "/",
title: "Software Engineer"
};
const heading = [
mainChalk(headingParts.name),
accentChalk(headingParts.separator),
mainChalk(headingParts.title)
].join(" ");
const text = `${" ".repeat(7)}${heading}
${links}`;
fs.writeFileSync(
"./bin/rmngsv.js",
`#!/usr/bin/env node
console.log(\`${boxen(text, {
padding: 1,
borderStyle: "round",
borderColor: accentColor
})}\`);
`
);