#!/usr/bin/env node | ||
const c = require('@buzuli/color') | ||
const boxen = require('boxen') | ||
const fs = require('fs') | ||
const path = require('path') | ||
const boxOptions = { | ||
padding: 1, | ||
margin: 1, | ||
bordStyle: 'round' | ||
} | ||
const binDir = require.resolve('./card.js') | ||
const datFile = path.resolve(path.dirname(binDir), process.stdout.isTTY ? 'card.color' : 'card.plain') | ||
const lc = c.white.bold | ||
const spacer = { label: '', value: '' } | ||
const data = { | ||
name: { | ||
label: '', | ||
value: c.grey(`${c.white.bold('Joel Edwards')} | ${c.orange('@buzuli')}`) | ||
}, | ||
work: { | ||
label: '', | ||
value: c.white(`Senior Data Engineer @ ${c.red('npm')}`) | ||
}, | ||
npm: { | ||
label: 'npm 📦', | ||
value: c.blue(`https://npmjs.com/~${c.orange('buzuli')}`) | ||
}, | ||
github: { | ||
label: 'Github 🐙', | ||
value: c.blue(`https://github.com/${c.orange('joeledwards')}`) | ||
}, | ||
twitter: { | ||
label: 'Twitter 🐦', | ||
value: c.blue(`https://twitter.com/${c.orange('buzuli')}`) | ||
}, | ||
linkedin: { | ||
label: 'Linkedin 🔗', | ||
value: c.blue(`https://linkedin.com/in/${c.orange('buzuli')}`) | ||
}, | ||
npx: { | ||
label: '$', | ||
value: c.red(`npx ${c.white('buzuli')}`) | ||
}, | ||
} | ||
const card = [ | ||
data.name, | ||
data.work, | ||
spacer, | ||
data.npm, | ||
data.github, | ||
data.twitter, | ||
data.linkedin, | ||
spacer, | ||
data.npx | ||
] | ||
const maxLabelLen = Object.values(data).reduce((m, d) => Math.max(m, d.label.length), 0) | ||
const text = card | ||
.map(({ label, value }) => { | ||
const pad = ' '.repeat(maxLabelLen - label.length) | ||
return c.grey(`${pad}${label} ${value}`) | ||
}) | ||
.join('\n') | ||
console.info(c.orange(boxen(text, boxOptions))) | ||
fs.readFile(datFile, (error, buffer) => { | ||
if (error) { | ||
console.error(`Error reading card data: ${error}`) | ||
process.exit(1) | ||
} else { | ||
console.info(buffer.toString()) | ||
} | ||
}) |
{ | ||
"name": "buzuli", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "Contact card for @buzuli", | ||
@@ -10,4 +10,12 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "node build.js", | ||
"prepare": "npm run build" | ||
}, | ||
"files": [ | ||
"package.json", | ||
"README.md", | ||
"bin/card.js", | ||
"bin/card.color", | ||
"bin/card.plain" | ||
], | ||
"repository": { | ||
@@ -25,3 +33,3 @@ "type": "git", | ||
"license": "MIT", | ||
"dependencies": { | ||
"devDependencies": { | ||
"@buzuli/color": "^2.1.0", | ||
@@ -28,0 +36,0 @@ "boxen": "^2.1.0" |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
0
-100%5
25%1
-50%3845
-98.29%2
Infinity%13
-77.97%1
Infinity%