-
Notifications
You must be signed in to change notification settings - Fork 4
/
postinstall.js
84 lines (80 loc) · 2.04 KB
/
postinstall.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
(function () {
const colors = {
reset: "\x1b[0m",
bright: "\x1b[1m",
fg: {
yellow: "\x1b[33m",
cyan: "\x1b[36m",
green: "\x1b[32m",
},
dim: "\x1b[2m",
};
const boxWidth = 70;
const horizontalBorder = "+" + "=".repeat(boxWidth - 2) + "+";
const emptyLine = "|" + " ".repeat(boxWidth - 2) + "|";
function stripAnsi(str) {
return str.replace(/\x1b\[[0-9;]*m/g, "");
}
function centeredText(text, width) {
const visibleLength = stripAnsi(text).length;
const padding = Math.max(0, width - visibleLength);
const leftPad = Math.floor(padding / 2);
const rightPad = padding - leftPad;
return "|" + " ".repeat(leftPad) + text + " ".repeat(rightPad) + "|";
}
console.log("\n" + colors.fg.yellow + horizontalBorder + colors.reset);
console.log(colors.fg.yellow + emptyLine + colors.reset);
console.log(
colors.fg.yellow +
centeredText(
colors.bright +
colors.fg.yellow +
"🚨 ATTENTION IPFS USERS! 🚨" +
colors.reset,
boxWidth - 2,
) +
colors.reset,
);
console.log(colors.fg.yellow + emptyLine + colors.reset);
console.log(
colors.fg.yellow +
centeredText(
colors.fg.cyan +
"If you're looking to use IPFS please install pinata-web3 instead." +
colors.reset,
boxWidth - 2,
) +
colors.reset,
);
console.log(colors.fg.yellow + emptyLine + colors.reset);
console.log(
colors.fg.yellow +
centeredText(
colors.fg.green + "npm install pinata-web3" + colors.reset,
boxWidth - 2,
) +
colors.reset,
);
console.log(colors.fg.yellow + emptyLine + colors.reset);
console.log(
colors.fg.yellow +
centeredText(
colors.dim +
"For more information please see our documentation at" +
colors.reset,
boxWidth - 2,
) +
colors.reset,
);
console.log(
colors.fg.yellow +
centeredText(
colors.dim + "https://docs.pinata.cloud/web3/sdk" + colors.reset,
boxWidth - 2,
) +
colors.reset,
);
console.log(colors.fg.yellow + emptyLine + colors.reset);
console.log(colors.fg.yellow + horizontalBorder + colors.reset);
console.log("\n");
})();