-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7e21b1
commit 524499f
Showing
1 changed file
with
80 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,84 @@ | ||
const colors = { | ||
reset: "\x1b[0m", | ||
bright: "\x1b[1m", | ||
fg: { | ||
yellow: "\x1b[33m", | ||
cyan: "\x1b[36m", | ||
green: "\x1b[32m", | ||
}, | ||
dim: "\x1b[2m", | ||
}; | ||
(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) + "|"; | ||
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 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) + "|"; | ||
} | ||
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"); | ||
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"); | ||
})(); |