Created
October 3, 2022 23:25
-
-
Save mrienstra/c7d24ecb41a1caa0de56c8a7f016e500 to your computer and use it in GitHub Desktop.
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
const colors = { | |
grey: 90, | |
red: 31, | |
yellow: 33, | |
blue: 34, | |
purple: 35, | |
cyan: 36, | |
white: 37, | |
}; | |
function wrapColorFunc (color, bold) { | |
bold = bold? 1 : 0; | |
const prefix = '\u001B[' + bold + ';' + color + 'm'; | |
return function (str) { | |
return str.split('\n').map(line => { | |
if (!line.trim()) return line; | |
return prefix + line + '\u001B[0;39m'; | |
}).join('\n'); | |
} | |
} | |
function wrapColorFuncs (color) { | |
const func = wrapColorFunc(color); | |
func.bold = wrapColorFunc(color, true); | |
return func; | |
} | |
const c = {}; | |
for (let color in colors) { | |
c[color] = wrapColorFuncs(colors[color]); | |
} | |
console.log('\n', | |
c.cyan('b '),c.blue('→'),c.white('package cost estimation on bundlephobia.com'),'\n', | |
c.cyan('c '),c.blue('→'),c.white('changelog'),'\n', | |
c.cyan('g '),c.blue('→'),c.white('github (gitlab, etc.) repository root'),'\n', | |
c.cyan('h '),c.blue('→'),c.white('homepage'),'\n', | |
c.cyan('i '),c.blue('→'),c.white('issues'),'\n', | |
c.cyan('n '),c.blue('→'),c.white('package info on npmjs.com'),'\n', | |
c.cyan('p '),c.blue('→'),c.white('pull requests'),'\n', | |
c.cyan('pp'),c.blue('→'),c.white('package cost estimation on packagephobia'),'\n', | |
c.cyan('r '),c.blue('→'),c.white('list of github releases'),'\n', | |
c.cyan('s '),c.blue('→'),c.white('source (repository subdirectory in case of a monorepo)'),'\n', | |
c.cyan('t '),c.blue('→'),c.white('list of git tags'),'\n', | |
c.cyan('u '),c.blue('→'),c.white('package contents preview on unpkg.com'),'\n', | |
c.cyan('v '),c.blue('→'),c.white('list of package versions with dates on npmjs.com'),'\n', | |
c.cyan('y '),c.blue('→'),c.white('package page on yarnpkg.com'),'\n', | |
c.cyan('. '),c.blue('→'),c.white('browse GitHub / GitLab code'),'\n' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment