brignano 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/dist/banner.js +57 -0
- package/dist/card.js +86 -119
- package/dist/cardBox.js +44 -0
- package/dist/data.js +37 -0
- package/dist/env.js +85 -0
- package/dist/live.js +43 -0
- package/dist/menu.js +86 -0
- package/dist/qrcode.js +8 -0
- package/dist/reveal.js +19 -0
- package/dist/vcard.js +40 -0
- package/package.json +33 -13
- package/readme.md +71 -36
- package/.github/workflows/ci.yml +0 -29
- package/.github/workflows/publish.yml +0 -32
- package/demo.gif +0 -0
- package/src/card.ts +0 -133
- package/tsconfig.json +0 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020-2026 Anthony Brignano
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/dist/banner.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import figlet from 'figlet';
|
|
2
|
+
import gradient from 'gradient-string';
|
|
3
|
+
import { sleep } from './reveal.js';
|
|
4
|
+
// Brand palette — matches brignano.io's electric indigo/violet accent
|
|
5
|
+
// (violet-700 → violet-500 → violet-400). Reads well on a dark terminal.
|
|
6
|
+
const BRAND = ['#6d28d9', '#8b5cf6', '#a78bfa'];
|
|
7
|
+
// A longer ramp with a bright crest (violet-300) used for the shimmer sweep.
|
|
8
|
+
const SHIMMER = [
|
|
9
|
+
'#5b21b6',
|
|
10
|
+
'#6d28d9',
|
|
11
|
+
'#7c3aed',
|
|
12
|
+
'#8b5cf6',
|
|
13
|
+
'#a78bfa',
|
|
14
|
+
'#c4b5fd',
|
|
15
|
+
'#a78bfa',
|
|
16
|
+
'#8b5cf6',
|
|
17
|
+
'#7c3aed',
|
|
18
|
+
'#6d28d9',
|
|
19
|
+
];
|
|
20
|
+
function bannerArt(text) {
|
|
21
|
+
try {
|
|
22
|
+
return figlet.textSync(text, { font: 'ANSI Shadow' });
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return text.toUpperCase();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function paint(colors, art) {
|
|
29
|
+
try {
|
|
30
|
+
return gradient(colors).multiline(art);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return art;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Static gradient banner (used for the non-animated path).
|
|
37
|
+
export function renderBanner(text = 'brignano') {
|
|
38
|
+
return paint(BRAND, bannerArt(text));
|
|
39
|
+
}
|
|
40
|
+
// Animated splash: a violet highlight sweeps across the letters, then settles on
|
|
41
|
+
// the static brand gradient. Redraws in place via ANSI cursor moves, so it must
|
|
42
|
+
// only be called on a TTY (the caller gates this behind `shouldAnimate`).
|
|
43
|
+
export async function animateBanner(text = 'brignano', frames = 14, frameMs = 70) {
|
|
44
|
+
const art = bannerArt(text);
|
|
45
|
+
const lineCount = art.split('\n').length;
|
|
46
|
+
for (let i = 0; i < frames; i++) {
|
|
47
|
+
const offset = i % SHIMMER.length;
|
|
48
|
+
const rotated = SHIMMER.slice(offset).concat(SHIMMER.slice(0, offset));
|
|
49
|
+
if (i > 0)
|
|
50
|
+
process.stdout.write(`\u001b[${lineCount}A`);
|
|
51
|
+
process.stdout.write(`\r${paint(rotated, art)}\n`);
|
|
52
|
+
await sleep(frameMs);
|
|
53
|
+
}
|
|
54
|
+
// Settle on the canonical brand gradient.
|
|
55
|
+
process.stdout.write(`\u001b[${lineCount}A`);
|
|
56
|
+
process.stdout.write(`${renderBanner(text)}\n`);
|
|
57
|
+
}
|
package/dist/card.js
CHANGED
|
@@ -1,126 +1,93 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import boxen from 'boxen';
|
|
3
2
|
import chalk from 'chalk';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import { animateBanner, renderBanner } from './banner.js';
|
|
4
|
+
import { renderCard } from './cardBox.js';
|
|
5
|
+
import { funFacts, pick, profile, taglines } from './data.js';
|
|
6
|
+
import { clearConsole, isInteractive, parseFlags, readVersion, shouldAnimate, shouldFetchLive, unknownFlags, } from './env.js';
|
|
7
|
+
import { fetchLive } from './live.js';
|
|
8
|
+
import { promptForAction, sendEmail, viewResume } from './menu.js';
|
|
9
|
+
import { renderQr } from './qrcode.js';
|
|
10
|
+
import { reveal, sleep } from './reveal.js';
|
|
11
|
+
import { writeAndOpenVCard } from './vcard.js';
|
|
12
|
+
function printHelp() {
|
|
13
|
+
console.log('\nUsage: npx brignano [options]\n');
|
|
14
|
+
console.log('Options:');
|
|
15
|
+
console.log(' -h, --help Show this help');
|
|
16
|
+
console.log(' -v, --version Print the version and exit');
|
|
17
|
+
console.log(' -r, --view Open my resume in your browser');
|
|
18
|
+
console.log(' -e, --email Open your mail client to email me');
|
|
19
|
+
console.log(' --qr Print a scannable QR code to my website');
|
|
20
|
+
console.log(' --vcard Save my contact card (.vcf) and open it');
|
|
21
|
+
console.log(' --no-animation Render instantly, skip the reveal animation');
|
|
22
|
+
console.log(' --no-prompt Show the card only (non-interactive)');
|
|
23
|
+
console.log(' -d, --download Deprecated alias for --view\n');
|
|
24
|
+
}
|
|
25
|
+
async function main() {
|
|
26
|
+
const argv = process.argv.slice(2);
|
|
27
|
+
// Reject typos loudly rather than silently rendering the default card.
|
|
28
|
+
const unknown = unknownFlags(argv);
|
|
29
|
+
if (unknown.length > 0) {
|
|
30
|
+
console.error(`Unknown option: ${unknown.join(', ')}`);
|
|
31
|
+
console.error("Run 'npx brignano --help' to see the available options.");
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const flags = parseFlags(argv);
|
|
36
|
+
// Direct-action flags short-circuit the full experience.
|
|
37
|
+
if (flags.help)
|
|
38
|
+
return printHelp();
|
|
39
|
+
if (flags.version) {
|
|
40
|
+
console.log(readVersion());
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (flags.view || flags.download) {
|
|
44
|
+
if (flags.download) {
|
|
45
|
+
console.warn('Note: --download is deprecated; opening the resume instead.');
|
|
10
46
|
}
|
|
11
|
-
|
|
47
|
+
return viewResume();
|
|
12
48
|
}
|
|
13
|
-
if (
|
|
14
|
-
|
|
49
|
+
if (flags.email)
|
|
50
|
+
return sendEmail();
|
|
51
|
+
if (flags.qr) {
|
|
52
|
+
console.log(await renderQr(profile.website));
|
|
53
|
+
console.log(chalk.gray(` ${profile.website}\n`));
|
|
54
|
+
return;
|
|
15
55
|
}
|
|
56
|
+
if (flags.vcard)
|
|
57
|
+
return writeAndOpenVCard();
|
|
58
|
+
const animate = shouldAnimate(flags);
|
|
59
|
+
const interactive = isInteractive(flags);
|
|
60
|
+
// Kick off the live fetch early (don't await yet) so its timeout budget
|
|
61
|
+
// overlaps the banner render. Skipped entirely when non-interactive/CI.
|
|
62
|
+
const livePromise = shouldFetchLive(flags) ? fetchLive() : Promise.resolve(null);
|
|
63
|
+
clearConsole();
|
|
64
|
+
// Banner first: an animated violet shimmer when we can animate, otherwise the
|
|
65
|
+
// static gradient.
|
|
66
|
+
if (animate) {
|
|
67
|
+
await animateBanner();
|
|
68
|
+
await sleep(120);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.log(renderBanner());
|
|
72
|
+
}
|
|
73
|
+
// Card, enriched with whatever the (bounded) live fetch returned.
|
|
74
|
+
const live = await livePromise;
|
|
75
|
+
const tagline = pick(taglines);
|
|
76
|
+
await reveal(renderCard({ live, tagline }), 30, animate);
|
|
77
|
+
console.log(`Tip: ${chalk.cyanBright.bold('cmd/ctrl + click')} the links above.`);
|
|
78
|
+
console.log(chalk.gray(` ${pick(funFacts)}\n`));
|
|
79
|
+
if (!interactive)
|
|
80
|
+
return;
|
|
81
|
+
const action = await promptForAction();
|
|
82
|
+
await action();
|
|
16
83
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
name: `Send me an ${chalk.green.bold('Email')}.`,
|
|
27
|
-
value: () => sendEmail(),
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: `View my ${chalk.magentaBright.bold('Resume')}.`,
|
|
31
|
-
value: () => viewResume(),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'Just quit.',
|
|
35
|
-
value: () => {
|
|
36
|
-
console.log('Have a good day!\n');
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
function sendEmail() {
|
|
43
|
-
open('mailto:hi@brignano.io')
|
|
44
|
-
.then(() => {
|
|
45
|
-
console.log('\nDone, see you soon at inbox.\n');
|
|
46
|
-
})
|
|
47
|
-
.catch((err) => {
|
|
48
|
-
console.error('Failed to open mail client:', err && err.message ? err.message : err);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function viewResume() {
|
|
52
|
-
const resumeUrl = 'https://brignano.io/resume';
|
|
53
|
-
open(resumeUrl)
|
|
54
|
-
.then(() => {
|
|
55
|
-
console.log(`\nOpened resume: ${resumeUrl}\n`);
|
|
56
|
-
})
|
|
57
|
-
.catch((err) => {
|
|
58
|
-
console.error('Failed to open resume URL:', err && err.message ? err.message : err);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const data = {
|
|
62
|
-
name: chalk.bold.green(' Anthony Brignano'),
|
|
63
|
-
handle: chalk.white('@brignano'),
|
|
64
|
-
work: `Senior Staff Software Engineer ${chalk.white('at')} ${chalk.hex('#3A5A78').bold('The Hartford')}`,
|
|
65
|
-
github: chalk.gray('https://github.com/') + chalk.green('brignano'),
|
|
66
|
-
linkedin: chalk.gray('https://linkedin.com/in/') + chalk.blue('brignano'),
|
|
67
|
-
web: chalk.cyan('https://brignano.io'),
|
|
68
|
-
npx: chalk.red('npx') + ' ' + chalk.white('brignano'),
|
|
69
|
-
labelWork: chalk.white.bold(' Work:'),
|
|
70
|
-
labelGitHub: chalk.white.bold(' GitHub:'),
|
|
71
|
-
labelLinkedIn: chalk.white.bold(' LinkedIn:'),
|
|
72
|
-
labelWeb: chalk.white.bold(' Website:'),
|
|
73
|
-
labelCard: chalk.white.bold(' Card:'),
|
|
74
|
-
};
|
|
75
|
-
const me = boxen([
|
|
76
|
-
`${data.name}`,
|
|
77
|
-
'',
|
|
78
|
-
`${data.labelWork} ${data.work}`,
|
|
79
|
-
'',
|
|
80
|
-
`${data.labelGitHub} ${data.github}`,
|
|
81
|
-
`${data.labelLinkedIn} ${data.linkedin}`,
|
|
82
|
-
`${data.labelWeb} ${data.web}`,
|
|
83
|
-
'',
|
|
84
|
-
`${data.labelCard} ${data.npx}`,
|
|
85
|
-
'',
|
|
86
|
-
`${chalk.italic("My inbox is always open. Whether you have a")}`,
|
|
87
|
-
`${chalk.italic("question or just want to say hi, I will try")}`,
|
|
88
|
-
`${chalk.italic("my best to get back to you! :)")}`,
|
|
89
|
-
].join('\n'), {
|
|
90
|
-
margin: 1,
|
|
91
|
-
float: 'center',
|
|
92
|
-
padding: 1,
|
|
93
|
-
borderStyle: 'single',
|
|
94
|
-
borderColor: 'green',
|
|
84
|
+
main().catch((err) => {
|
|
85
|
+
// Ctrl+C / Esc at the menu is a normal way to leave, not a crash.
|
|
86
|
+
if (err instanceof Error && err.name === 'ExitPromptError') {
|
|
87
|
+
console.log('\nHave a great day!\n');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
91
|
+
console.error(`Something went wrong: ${message}`);
|
|
92
|
+
process.exitCode = 1;
|
|
95
93
|
});
|
|
96
|
-
console.log(me);
|
|
97
|
-
const tip = [`Tip: Try ${chalk.cyanBright.bold('cmd/ctrl + click')} on the links above`, ''].join('\n');
|
|
98
|
-
console.log(tip);
|
|
99
|
-
// Simple argument parsing
|
|
100
|
-
const argv = process.argv.slice(2);
|
|
101
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
102
|
-
console.log('\nUsage: npx brignano [options]\n');
|
|
103
|
-
console.log('Options:');
|
|
104
|
-
console.log(' -h, --help Show this help');
|
|
105
|
-
console.log(' -v, --view Open resume in browser (https://brignano.io/resume)');
|
|
106
|
-
console.log(' -d, --download Deprecated: previously downloaded resume — now opens resume in browser');
|
|
107
|
-
console.log(' -e, --email Open mail client to email me');
|
|
108
|
-
console.log(' --no-prompt Show card only (non-interactive)\n');
|
|
109
|
-
}
|
|
110
|
-
else if (argv.includes('--view') || argv.includes('-v')) {
|
|
111
|
-
viewResume();
|
|
112
|
-
}
|
|
113
|
-
else if (argv.includes('--download') || argv.includes('-d')) {
|
|
114
|
-
console.warn('Warning: `--download` is deprecated and now opens the resume in your browser.');
|
|
115
|
-
viewResume();
|
|
116
|
-
}
|
|
117
|
-
else if (argv.includes('--email') || argv.includes('-e')) {
|
|
118
|
-
sendEmail();
|
|
119
|
-
}
|
|
120
|
-
else if (argv.includes('--no-prompt') || argv.includes('--quiet')) {
|
|
121
|
-
console.log('\nExiting in non-interactive mode (--no-prompt).');
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
|
-
prompt(questions).then((answer) => answer.action());
|
|
126
|
-
}
|
package/dist/cardBox.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import boxen from 'boxen';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { profile } from './data.js';
|
|
4
|
+
// Right-aligns labels to a common width so the values line up cleanly.
|
|
5
|
+
const LABEL_WIDTH = 10;
|
|
6
|
+
function label(text) {
|
|
7
|
+
return chalk.white.bold(text.padStart(LABEL_WIDTH) + ':');
|
|
8
|
+
}
|
|
9
|
+
// Builds the boxen business card. `live` is optional — when absent the live
|
|
10
|
+
// line is simply omitted, so the card looks intentional with or without network.
|
|
11
|
+
export function renderCard({ live, tagline }) {
|
|
12
|
+
// Violet accent matches brignano.io (violet-400 #a78bfa on dark).
|
|
13
|
+
const accent = chalk.hex('#a78bfa');
|
|
14
|
+
const lines = [
|
|
15
|
+
accent.bold(profile.fullName) + ' ' + chalk.gray(profile.handle),
|
|
16
|
+
'',
|
|
17
|
+
`${label('Work')} ${profile.title} ${chalk.gray('at')} ${chalk
|
|
18
|
+
.hex('#3A5A78')
|
|
19
|
+
.bold(profile.org)}`,
|
|
20
|
+
'',
|
|
21
|
+
`${label('GitHub')} ${chalk.gray('https://github.com/')}${chalk.green(profile.username)}`,
|
|
22
|
+
`${label('LinkedIn')} ${chalk.gray('https://linkedin.com/in/')}${chalk.blue(profile.username)}`,
|
|
23
|
+
`${label('Website')} ${chalk.cyan(profile.website)}`,
|
|
24
|
+
];
|
|
25
|
+
if (live) {
|
|
26
|
+
lines.push('');
|
|
27
|
+
const parts = [
|
|
28
|
+
`${chalk.yellow('★')} ${chalk.bold(live.followers)} followers`,
|
|
29
|
+
`${chalk.bold(live.publicRepos)} repos`,
|
|
30
|
+
];
|
|
31
|
+
if (live.latestRepo) {
|
|
32
|
+
parts.push(`latest: ${chalk.green(live.latestRepo.name)}`);
|
|
33
|
+
}
|
|
34
|
+
lines.push(`${label('Live')} ${chalk.gray(parts.join(' · '))}`);
|
|
35
|
+
}
|
|
36
|
+
lines.push('', `${label('Card')} ${chalk.red('npx')} ${chalk.white('brignano')}`, '', chalk.italic(tagline));
|
|
37
|
+
return boxen(lines.join('\n'), {
|
|
38
|
+
margin: 1,
|
|
39
|
+
float: 'center',
|
|
40
|
+
padding: 1,
|
|
41
|
+
borderStyle: 'round',
|
|
42
|
+
borderColor: 'gray',
|
|
43
|
+
});
|
|
44
|
+
}
|
package/dist/data.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Single source of truth for everything the card, vCard, QR and live modules need.
|
|
2
|
+
// Plain (uncolored) values live here; chalk styling is applied at render time.
|
|
3
|
+
export const profile = {
|
|
4
|
+
firstName: 'Anthony',
|
|
5
|
+
lastName: 'Brignano',
|
|
6
|
+
fullName: 'Anthony Brignano',
|
|
7
|
+
handle: '@brignano',
|
|
8
|
+
username: 'brignano',
|
|
9
|
+
title: 'Senior Staff Software Engineer',
|
|
10
|
+
org: 'The Hartford',
|
|
11
|
+
email: 'hi@brignano.io',
|
|
12
|
+
website: 'https://brignano.io',
|
|
13
|
+
resume: 'https://brignano.io/resume',
|
|
14
|
+
github: 'https://github.com/brignano',
|
|
15
|
+
linkedin: 'https://linkedin.com/in/brignano',
|
|
16
|
+
};
|
|
17
|
+
// Rotating taglines — one is picked per run so repeat visitors see variety.
|
|
18
|
+
export const taglines = [
|
|
19
|
+
'My inbox is always open. Ask a question or just say hi — I read everything.',
|
|
20
|
+
'Building reliable systems, mentoring engineers, and shipping things that last.',
|
|
21
|
+
"If it's worth automating, it's worth a clean abstraction. Let's build.",
|
|
22
|
+
'Self-hoster, spec-driven, and unreasonably fond of a tidy terminal.',
|
|
23
|
+
'Good engineering is mostly good taste applied consistently. Say hello.',
|
|
24
|
+
];
|
|
25
|
+
// Small easter-egg facts, shown occasionally below the card.
|
|
26
|
+
export const funFacts = [
|
|
27
|
+
'This card is open source — `npx brignano --help` shows every trick.',
|
|
28
|
+
'Tip: scan the QR with your phone to save my contact instantly.',
|
|
29
|
+
'The live stats above are pulled fresh from GitHub (with a strict timeout).',
|
|
30
|
+
];
|
|
31
|
+
// Deterministic-enough pick without Math.random (kept simple + dependency-free).
|
|
32
|
+
// The `?? items[0]` fallback is unreachable for a NonEmpty list, but it keeps the
|
|
33
|
+
// return type honest under `noUncheckedIndexedAccess` without an assertion.
|
|
34
|
+
export function pick(items, seed = Date.now()) {
|
|
35
|
+
const index = Math.floor(seed / 1000) % items.length;
|
|
36
|
+
return items[index] ?? items[0];
|
|
37
|
+
}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Environment + capability detection. Keeps the render logic free of scattered
|
|
2
|
+
// `process.stdout.isTTY` checks and guarantees CI / piped output never hangs.
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
// Every accepted token, grouped by the flag it sets. Also drives unknown-flag
|
|
7
|
+
// detection below, so adding a flag here is the only edit needed.
|
|
8
|
+
const FLAG_ALIASES = {
|
|
9
|
+
help: ['--help', '-h'],
|
|
10
|
+
version: ['--version', '-v', '-V'],
|
|
11
|
+
view: ['--view', '--resume', '-r'],
|
|
12
|
+
download: ['--download', '-d'],
|
|
13
|
+
email: ['--email', '-e'],
|
|
14
|
+
qr: ['--qr'],
|
|
15
|
+
vcard: ['--vcard', '--save-contact'],
|
|
16
|
+
noPrompt: ['--no-prompt', '--quiet'],
|
|
17
|
+
noAnimation: ['--no-animation'],
|
|
18
|
+
};
|
|
19
|
+
const KNOWN_TOKENS = new Set(Object.values(FLAG_ALIASES).flat());
|
|
20
|
+
export function hasFlag(argv, names) {
|
|
21
|
+
return names.some((n) => argv.includes(n));
|
|
22
|
+
}
|
|
23
|
+
export function parseFlags(argv) {
|
|
24
|
+
return {
|
|
25
|
+
help: hasFlag(argv, FLAG_ALIASES.help),
|
|
26
|
+
version: hasFlag(argv, FLAG_ALIASES.version),
|
|
27
|
+
view: hasFlag(argv, FLAG_ALIASES.view),
|
|
28
|
+
download: hasFlag(argv, FLAG_ALIASES.download),
|
|
29
|
+
email: hasFlag(argv, FLAG_ALIASES.email),
|
|
30
|
+
qr: hasFlag(argv, FLAG_ALIASES.qr),
|
|
31
|
+
vcard: hasFlag(argv, FLAG_ALIASES.vcard),
|
|
32
|
+
noPrompt: hasFlag(argv, FLAG_ALIASES.noPrompt),
|
|
33
|
+
noAnimation: hasFlag(argv, FLAG_ALIASES.noAnimation),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Anything that looks like a flag but isn't one we accept. Returned rather than
|
|
37
|
+
// thrown so the caller decides how loudly to complain.
|
|
38
|
+
export function unknownFlags(argv) {
|
|
39
|
+
return argv.filter((arg) => arg.startsWith('-') && !KNOWN_TOKENS.has(arg));
|
|
40
|
+
}
|
|
41
|
+
// Read the version straight from the published package.json. It isn't in the
|
|
42
|
+
// `files` list, but npm always ships package.json, and it sits one level above
|
|
43
|
+
// the compiled dist/ directory.
|
|
44
|
+
export function readVersion() {
|
|
45
|
+
try {
|
|
46
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
47
|
+
const raw = readFileSync(join(here, '..', 'package.json'), 'utf8');
|
|
48
|
+
const pkg = JSON.parse(raw);
|
|
49
|
+
return typeof pkg.version === 'string' ? pkg.version : 'unknown';
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return 'unknown';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const isCI = () => Boolean(process.env.CI);
|
|
56
|
+
// True only when we can safely show an interactive prompt.
|
|
57
|
+
export function isInteractive(flags) {
|
|
58
|
+
return Boolean(process.stdout.isTTY && process.stdin.isTTY && !isCI() && !flags.noPrompt);
|
|
59
|
+
}
|
|
60
|
+
// True only when the reveal animation should play.
|
|
61
|
+
export function shouldAnimate(flags) {
|
|
62
|
+
return Boolean(process.stdout.isTTY &&
|
|
63
|
+
!isCI() &&
|
|
64
|
+
!flags.noPrompt &&
|
|
65
|
+
!flags.noAnimation &&
|
|
66
|
+
!process.env.NO_COLOR);
|
|
67
|
+
}
|
|
68
|
+
// True only when we should spend time on a live network fetch.
|
|
69
|
+
export function shouldFetchLive(flags) {
|
|
70
|
+
return isInteractive(flags);
|
|
71
|
+
}
|
|
72
|
+
export function clearConsole() {
|
|
73
|
+
const out = process.stdout;
|
|
74
|
+
if (typeof out.clear === 'function') {
|
|
75
|
+
try {
|
|
76
|
+
out.clear();
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
/* ignore */
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (process.stdout.isTTY) {
|
|
83
|
+
process.stdout.write('\u001b[2J\u001b[0f');
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/live.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { profile } from './data.js';
|
|
2
|
+
const API = 'https://api.github.com';
|
|
3
|
+
const HEADERS = {
|
|
4
|
+
'User-Agent': 'npx-brignano',
|
|
5
|
+
Accept: 'application/vnd.github+json',
|
|
6
|
+
};
|
|
7
|
+
// Fetches live GitHub stats with a hard timeout. ANY failure (timeout, offline,
|
|
8
|
+
// non-200, rate-limit, parse error) resolves to null — this never throws and
|
|
9
|
+
// never blocks the card for longer than `timeoutMs`.
|
|
10
|
+
export async function fetchLive(timeoutMs = 1500) {
|
|
11
|
+
const controller = new AbortController();
|
|
12
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
13
|
+
try {
|
|
14
|
+
const [userRes, reposRes] = await Promise.all([
|
|
15
|
+
fetch(`${API}/users/${profile.username}`, {
|
|
16
|
+
headers: HEADERS,
|
|
17
|
+
signal: controller.signal,
|
|
18
|
+
}),
|
|
19
|
+
fetch(`${API}/users/${profile.username}/repos?sort=updated&per_page=1`, {
|
|
20
|
+
headers: HEADERS,
|
|
21
|
+
signal: controller.signal,
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
24
|
+
if (!userRes.ok || !reposRes.ok)
|
|
25
|
+
return null;
|
|
26
|
+
const user = (await userRes.json());
|
|
27
|
+
const repos = (await reposRes.json());
|
|
28
|
+
const latest = Array.isArray(repos) ? repos[0] : undefined;
|
|
29
|
+
return {
|
|
30
|
+
followers: user.followers ?? 0,
|
|
31
|
+
publicRepos: user.public_repos ?? 0,
|
|
32
|
+
latestRepo: latest?.name && latest?.html_url
|
|
33
|
+
? { name: latest.name, url: latest.html_url }
|
|
34
|
+
: undefined,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
}
|
|
43
|
+
}
|
package/dist/menu.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { select } from '@inquirer/prompts';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import clipboard from 'clipboardy';
|
|
4
|
+
import open from 'open';
|
|
5
|
+
import { profile } from './data.js';
|
|
6
|
+
import { renderQr } from './qrcode.js';
|
|
7
|
+
import { buildVCard, writeAndOpenVCard } from './vcard.js';
|
|
8
|
+
// --- Action helpers (kept as named functions so flags and the menu share them) ---
|
|
9
|
+
export async function copyEmail() {
|
|
10
|
+
try {
|
|
11
|
+
await clipboard.write(profile.email);
|
|
12
|
+
console.log(`\n${chalk.green('Copied')} ${profile.email} to your clipboard.\n`);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Clipboard access fails in headless/SSH environments — degrade gracefully.
|
|
16
|
+
console.log(`\nMy email is ${chalk.green(profile.email)} — drop me a line!\n`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function sendEmail() {
|
|
20
|
+
try {
|
|
21
|
+
await open(`mailto:${profile.email}`);
|
|
22
|
+
console.log('\nOpened your mail client — see you in the inbox.\n');
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
26
|
+
console.error(`Failed to open mail client: ${message}`);
|
|
27
|
+
console.error(`Reach me directly at ${profile.email}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export async function openUrl(url, label) {
|
|
31
|
+
try {
|
|
32
|
+
await open(url);
|
|
33
|
+
console.log(`\nOpened ${label}: ${url}\n`);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
37
|
+
console.error(`Failed to open ${label}: ${message}`);
|
|
38
|
+
console.error(`Here it is: ${url}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function viewResume() {
|
|
42
|
+
await openUrl(profile.resume, 'resume');
|
|
43
|
+
}
|
|
44
|
+
export async function showContactQr() {
|
|
45
|
+
const qr = await renderQr(buildVCard());
|
|
46
|
+
console.log('\nScan to save my contact:\n');
|
|
47
|
+
console.log(qr);
|
|
48
|
+
}
|
|
49
|
+
export function buildChoices() {
|
|
50
|
+
return [
|
|
51
|
+
{ name: `Copy my ${chalk.green.bold('email')} to clipboard`, value: copyEmail },
|
|
52
|
+
{ name: `Send me an ${chalk.green.bold('email')}`, value: sendEmail },
|
|
53
|
+
{
|
|
54
|
+
name: `Open my ${chalk.green.bold('GitHub')}`,
|
|
55
|
+
value: () => openUrl(profile.github, 'GitHub'),
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: `Open my ${chalk.blue.bold('LinkedIn')}`,
|
|
59
|
+
value: () => openUrl(profile.linkedin, 'LinkedIn'),
|
|
60
|
+
},
|
|
61
|
+
{ name: `View my ${chalk.magentaBright.bold('resume')}`, value: viewResume },
|
|
62
|
+
{
|
|
63
|
+
name: `Save my ${chalk.cyan.bold('contact')} (.vcf)`,
|
|
64
|
+
value: writeAndOpenVCard,
|
|
65
|
+
},
|
|
66
|
+
{ name: `Show a ${chalk.yellow.bold('contact QR')} code`, value: showContactQr },
|
|
67
|
+
{
|
|
68
|
+
name: 'Just quit',
|
|
69
|
+
value: () => {
|
|
70
|
+
console.log('\nHave a great day!\n');
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
// Shows the action menu and returns the chosen handler. Ctrl+C / Esc throws an
|
|
76
|
+
// `ExitPromptError`, which the entry point treats as a normal exit.
|
|
77
|
+
export async function promptForAction() {
|
|
78
|
+
const choices = buildChoices();
|
|
79
|
+
return select({
|
|
80
|
+
message: 'What would you like to do?',
|
|
81
|
+
choices,
|
|
82
|
+
// Default page size is 7, which would hide the last entry behind a scroll.
|
|
83
|
+
// Show every action at once — the list is short and fixed.
|
|
84
|
+
pageSize: choices.length,
|
|
85
|
+
});
|
|
86
|
+
}
|
package/dist/qrcode.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import qrcode from 'qrcode-terminal';
|
|
2
|
+
// Promisified wrapper around qrcode-terminal's callback API. `small: true` keeps
|
|
3
|
+
// the code compact enough for most terminals.
|
|
4
|
+
export function renderQr(text) {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
qrcode.generate(text, { small: true }, (output) => resolve(output));
|
|
7
|
+
});
|
|
8
|
+
}
|
package/dist/reveal.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Tiny animation helpers — no dependencies. Line-by-line reveal is immune to the
|
|
2
|
+
// ANSI-escape-splitting problem a per-character typewriter would hit, and the
|
|
3
|
+
// total budget stays well under a second.
|
|
4
|
+
export function sleep(ms) {
|
|
5
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6
|
+
}
|
|
7
|
+
// Prints `text` one line at a time, pausing `perLineMs` between lines.
|
|
8
|
+
// When `animate` is false, prints everything at once (CI / piped / --no-animation).
|
|
9
|
+
export async function reveal(text, perLineMs = 35, animate = true) {
|
|
10
|
+
if (!animate) {
|
|
11
|
+
console.log(text);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const lines = text.split('\n');
|
|
15
|
+
for (const line of lines) {
|
|
16
|
+
console.log(line);
|
|
17
|
+
await sleep(perLineMs);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/vcard.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import open from 'open';
|
|
5
|
+
import { profile } from './data.js';
|
|
6
|
+
// Builds a valid vCard 3.0 string (broadest contact-app compatibility) with the
|
|
7
|
+
// spec-required CRLF line endings.
|
|
8
|
+
export function buildVCard() {
|
|
9
|
+
const lines = [
|
|
10
|
+
'BEGIN:VCARD',
|
|
11
|
+
'VERSION:3.0',
|
|
12
|
+
`N:${profile.lastName};${profile.firstName};;;`,
|
|
13
|
+
`FN:${profile.fullName}`,
|
|
14
|
+
`ORG:${profile.org}`,
|
|
15
|
+
`TITLE:${profile.title}`,
|
|
16
|
+
`EMAIL;TYPE=INTERNET,PREF:${profile.email}`,
|
|
17
|
+
`URL:${profile.website}`,
|
|
18
|
+
`X-SOCIALPROFILE;TYPE=github:${profile.github}`,
|
|
19
|
+
`X-SOCIALPROFILE;TYPE=linkedin:${profile.linkedin}`,
|
|
20
|
+
'NOTE:npx brignano',
|
|
21
|
+
'END:VCARD',
|
|
22
|
+
];
|
|
23
|
+
return lines.join('\r\n') + '\r\n';
|
|
24
|
+
}
|
|
25
|
+
// Writes the vCard to a temp file and asks the OS to open it (Contacts on
|
|
26
|
+
// macOS/iOS, the default handler elsewhere). On failure, prints the path so the
|
|
27
|
+
// user can open it manually — never throws.
|
|
28
|
+
export async function writeAndOpenVCard() {
|
|
29
|
+
const file = join(tmpdir(), 'anthony-brignano.vcf');
|
|
30
|
+
try {
|
|
31
|
+
writeFileSync(file, buildVCard(), 'utf8');
|
|
32
|
+
await open(file);
|
|
33
|
+
console.log(`\nSaved my contact card to: ${file}\n`);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
37
|
+
console.error(`\nCouldn't open the contact card automatically (${message}).`);
|
|
38
|
+
console.error(`It's saved here — open it manually: ${file}\n`);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brignano",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "dist/card.js",
|
|
6
5
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
6
|
+
"node": ">=20"
|
|
8
7
|
},
|
|
9
8
|
"bin": {
|
|
10
9
|
"brignano": "dist/card.js"
|
|
11
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
12
14
|
"scripts": {
|
|
13
15
|
"build": "tsc",
|
|
14
|
-
"dev": "
|
|
16
|
+
"dev": "tsx src/card.ts",
|
|
15
17
|
"start": "node dist/card.js",
|
|
18
|
+
"lint": "biome check .",
|
|
19
|
+
"format": "biome check --write .",
|
|
16
20
|
"test": "node dist/card.js --no-prompt",
|
|
17
21
|
"prepare": "npm run build"
|
|
18
22
|
},
|
|
@@ -26,18 +30,34 @@
|
|
|
26
30
|
"url": "https://github.com/brignano/npx-brignano/issues"
|
|
27
31
|
},
|
|
28
32
|
"homepage": "https://github.com/brignano/npx-brignano#readme",
|
|
29
|
-
"keywords": [
|
|
33
|
+
"keywords": [
|
|
34
|
+
"npx",
|
|
35
|
+
"business-card",
|
|
36
|
+
"cli",
|
|
37
|
+
"brignano",
|
|
38
|
+
"resume",
|
|
39
|
+
"vcard"
|
|
40
|
+
],
|
|
30
41
|
"description": "A personal card for Anthony Brignano (@brignano)",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"provenance": true
|
|
45
|
+
},
|
|
31
46
|
"dependencies": {
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
47
|
+
"@inquirer/prompts": "^8.6.0",
|
|
48
|
+
"boxen": "^8.0.1",
|
|
49
|
+
"chalk": "^6.0.0",
|
|
50
|
+
"clipboardy": "^5.3.2",
|
|
51
|
+
"figlet": "^1.11.4",
|
|
52
|
+
"gradient-string": "^3.0.0",
|
|
53
|
+
"open": "^11.0.1",
|
|
54
|
+
"qrcode-terminal": "^0.12.0"
|
|
36
55
|
},
|
|
37
56
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"@types/node": "^20.
|
|
41
|
-
"
|
|
57
|
+
"@biomejs/biome": "^2.5.10",
|
|
58
|
+
"@types/figlet": "^1.7.0",
|
|
59
|
+
"@types/node": "^22.20.1",
|
|
60
|
+
"tsx": "^4.23.12",
|
|
61
|
+
"typescript": "^5.9.3"
|
|
42
62
|
}
|
|
43
63
|
}
|
package/readme.md
CHANGED
|
@@ -1,66 +1,101 @@
|
|
|
1
|
-
#
|
|
1
|
+
# npx-brignano
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/brignano)
|
|
4
|
+
[](https://www.npmjs.com/package/brignano)
|
|
5
|
+
[](https://github.com/brignano/npx-brignano/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
An interactive terminal business card for Anthony Brignano. Run it with `npx` to get a gradient ASCII-art intro, a styled card with **live GitHub stats**, and quick actions — copy my email, open my socials, save my contact, or grab a scannable QR code.
|
|
9
|
+
|
|
10
|
+
## Quick start
|
|
4
11
|
|
|
5
|
-
👇 just hit
|
|
6
12
|
```bash
|
|
7
13
|
npx brignano
|
|
8
14
|
```
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# npx-brignano <a href="#"><img src="https://img.shields.io/badge/-npx%20brignano-white?style=flat-square&logo=npm&logoColor=grey" align="right" alt="npm Badge"></img></a>
|
|
16
|
+

|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
## What it does
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
- **Gradient ASCII banner** (`figlet` + `gradient-string`) with a smooth line-by-line reveal animation.
|
|
21
|
+
- **Styled business card** (`boxen` + `chalk`) with name, role, and links.
|
|
22
|
+
- **Live GitHub stats** — follower/repo counts and my latest repo, fetched fresh with a strict ~1.5s timeout. If the network is slow or offline, the card renders instantly and just omits the live line. It never hangs.
|
|
23
|
+
- **Interactive menu** (`inquirer`) with quick actions:
|
|
24
|
+
- Copy my email to your clipboard
|
|
25
|
+
- Send me an email (`mailto:`)
|
|
26
|
+
- Open my GitHub / LinkedIn
|
|
27
|
+
- View my resume
|
|
28
|
+
- Save my contact as a `.vcf` (opens in Contacts)
|
|
29
|
+
- Show a scannable contact **QR code**
|
|
30
|
+
- Quit
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
npx brignano
|
|
20
|
-
```
|
|
32
|
+
The animation, network fetch, and prompt are all skipped automatically when output isn't a TTY (piped, CI, or `--no-prompt`), so it stays fast and never blocks scripts.
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
## CLI
|
|
23
35
|
|
|
24
|
-
|
|
36
|
+
Run `npx brignano --help` to see this list.
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
| Flag | Description |
|
|
39
|
+
|------|-------------|
|
|
40
|
+
| `-h, --help` | Show help and exit. |
|
|
41
|
+
| `-v, --version` | Print the installed version and exit. |
|
|
42
|
+
| `-r, --view` / `--resume` | Open my resume in your default browser (`https://brignano.io/resume`). |
|
|
43
|
+
| `-e, --email` | Open your mail client with a new message to `hi@brignano.io`. |
|
|
44
|
+
| `--qr` | Print a scannable QR code to my website and exit. |
|
|
45
|
+
| `--vcard` / `--save-contact` | Save my contact card (`.vcf`) and open it. |
|
|
46
|
+
| `--no-animation` | Render the full card instantly, skipping the reveal animation. |
|
|
47
|
+
| `--no-prompt` | Show the card only and exit (non-interactive). |
|
|
48
|
+
| `-d, --download` | Deprecated alias for `--view`. |
|
|
27
49
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- Send an email (opens your mail client with `mailto:`)
|
|
31
|
-
- Download the resume (fetches a resume HTML and opens it locally)
|
|
32
|
-
- Quit
|
|
50
|
+
Unrecognized flags exit with a non-zero status instead of silently falling back
|
|
51
|
+
to the default card.
|
|
33
52
|
|
|
34
|
-
|
|
53
|
+
> **Note:** as of `2.0.0`, `-v` prints the version (the near-universal CLI
|
|
54
|
+
> convention). The resume now lives at `-r`, and the long `--view` flag is
|
|
55
|
+
> unchanged.
|
|
35
56
|
|
|
36
|
-
|
|
37
|
-
- `package.json` — project metadata and `bin` entry used by `npx`.
|
|
57
|
+
### Examples
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
```bash
|
|
60
|
+
npx brignano # full interactive experience
|
|
61
|
+
npx brignano --view # jump straight to my resume
|
|
62
|
+
npx brignano --version # print the version
|
|
63
|
+
npx brignano --qr # print a QR code to my site
|
|
64
|
+
npx brignano --vcard # save my contact card
|
|
65
|
+
npx brignano --no-prompt # card only (useful in CI/scripts)
|
|
66
|
+
```
|
|
40
67
|
|
|
41
|
-
|
|
42
|
-
- Or clone and run locally:
|
|
68
|
+
## Local development
|
|
43
69
|
|
|
44
70
|
```bash
|
|
45
|
-
git clone https://github.com/brignano/
|
|
71
|
+
git clone https://github.com/brignano/npx-brignano.git
|
|
46
72
|
cd npx-brignano
|
|
47
73
|
npm install
|
|
48
|
-
|
|
74
|
+
npm run build
|
|
75
|
+
node dist/card.js
|
|
49
76
|
```
|
|
50
77
|
|
|
51
|
-
|
|
78
|
+
Source lives in `src/` (split into small modules — `card.ts` is the entry/`bin`
|
|
79
|
+
target) and compiles to `dist/` via `tsc`. `npm run dev` runs the TypeScript
|
|
80
|
+
directly through `tsx`; `npm run lint` and `npm run format` use
|
|
81
|
+
[Biome](https://biomejs.dev).
|
|
82
|
+
|
|
83
|
+
Only `dist/` is published — the tarball is ~8 kB, so `npx brignano` stays a fast
|
|
84
|
+
cold start.
|
|
85
|
+
|
|
86
|
+
## Prerequisites
|
|
52
87
|
|
|
53
|
-
- Node.js (
|
|
88
|
+
- Node.js **>=20** (`npx` ships with npm).
|
|
54
89
|
|
|
55
|
-
Notes
|
|
90
|
+
## Notes
|
|
56
91
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
92
|
+
- Links printed in the card are cmd/ctrl+clickable in supported terminals.
|
|
93
|
+
- The `--download` flag is deprecated and now opens the resume in your browser instead of writing a local file.
|
|
59
94
|
|
|
60
|
-
Credits
|
|
95
|
+
## Credits
|
|
61
96
|
|
|
62
|
-
|
|
97
|
+
Inspired by [anmol098/npx_card](https://github.com/anmol098/npx_card).
|
|
63
98
|
|
|
64
|
-
License
|
|
99
|
+
## License
|
|
65
100
|
|
|
66
|
-
|
|
101
|
+
[ISC](LICENSE) © Anthony Brignano
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
paths:
|
|
6
|
-
- '**/*.ts'
|
|
7
|
-
- '*.json'
|
|
8
|
-
- '.github/workflows/ci.yml'
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
strategy:
|
|
14
|
-
matrix:
|
|
15
|
-
node-version: [18.x, 20.x]
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v6
|
|
18
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
19
|
-
uses: actions/setup-node@v6
|
|
20
|
-
with:
|
|
21
|
-
node-version: ${{ matrix.node-version }}
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: npm ci
|
|
24
|
-
- name: Build
|
|
25
|
-
run: npm run build
|
|
26
|
-
- name: Test (non-interactive)
|
|
27
|
-
run: npm test
|
|
28
|
-
env:
|
|
29
|
-
CI: true
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Publish Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
release:
|
|
9
|
-
types: [created]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
publish:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v6
|
|
16
|
-
- name: Use Node.js
|
|
17
|
-
uses: actions/setup-node@v6
|
|
18
|
-
with:
|
|
19
|
-
node-version: '20.x'
|
|
20
|
-
registry-url: 'https://registry.npmjs.org'
|
|
21
|
-
- name: Install & Build
|
|
22
|
-
run: |
|
|
23
|
-
npm ci
|
|
24
|
-
npm run build
|
|
25
|
-
- name: Test (non-interactive)
|
|
26
|
-
run: npm test
|
|
27
|
-
env:
|
|
28
|
-
CI: true
|
|
29
|
-
- name: Publish to npm
|
|
30
|
-
env:
|
|
31
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
32
|
-
run: npm publish --access public
|
package/demo.gif
DELETED
|
Binary file
|
package/src/card.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import boxen from 'boxen';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import inquirer from 'inquirer';
|
|
6
|
-
import open from 'open';
|
|
7
|
-
|
|
8
|
-
function clearConsole(): void {
|
|
9
|
-
if (typeof (process.stdout as any).clear === 'function') {
|
|
10
|
-
try { (process.stdout as any).clear(); } catch (e) { /* ignore */ }
|
|
11
|
-
}
|
|
12
|
-
if (process.stdout.isTTY) {
|
|
13
|
-
process.stdout.write('\u001b[2J\u001b[0f');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
clearConsole();
|
|
18
|
-
|
|
19
|
-
const prompt = inquirer.createPromptModule();
|
|
20
|
-
|
|
21
|
-
const questions = [
|
|
22
|
-
{
|
|
23
|
-
type: 'list',
|
|
24
|
-
name: 'action',
|
|
25
|
-
message: 'What you want to do?',
|
|
26
|
-
choices: [
|
|
27
|
-
{
|
|
28
|
-
name: `Send me an ${chalk.green.bold('Email')}.`,
|
|
29
|
-
value: () => sendEmail(),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: `View my ${chalk.magentaBright.bold('Resume')}.`,
|
|
33
|
-
value: () => viewResume(),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'Just quit.',
|
|
37
|
-
value: () => {
|
|
38
|
-
console.log('Have a good day!\n');
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
function sendEmail(): void {
|
|
46
|
-
open('mailto:hi@brignano.io')
|
|
47
|
-
.then(() => {
|
|
48
|
-
console.log('\nDone, see you soon at inbox.\n');
|
|
49
|
-
})
|
|
50
|
-
.catch((err: any) => {
|
|
51
|
-
console.error('Failed to open mail client:', err && err.message ? err.message : err);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function viewResume(): void {
|
|
56
|
-
const resumeUrl = 'https://brignano.io/resume';
|
|
57
|
-
open(resumeUrl)
|
|
58
|
-
.then(() => {
|
|
59
|
-
console.log(`\nOpened resume: ${resumeUrl}\n`);
|
|
60
|
-
})
|
|
61
|
-
.catch((err: any) => {
|
|
62
|
-
console.error('Failed to open resume URL:', err && err.message ? err.message : err);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const data = {
|
|
67
|
-
name: chalk.bold.green(' Anthony Brignano'),
|
|
68
|
-
handle: chalk.white('@brignano'),
|
|
69
|
-
work: `Senior Staff Software Engineer ${chalk.white('at')} ${chalk.hex('#3A5A78').bold('The Hartford')}`,
|
|
70
|
-
github: chalk.gray('https://github.com/') + chalk.green('brignano'),
|
|
71
|
-
linkedin: chalk.gray('https://linkedin.com/in/') + chalk.blue('brignano'),
|
|
72
|
-
web: chalk.cyan('https://brignano.io'),
|
|
73
|
-
npx: chalk.red('npx') + ' ' + chalk.white('brignano'),
|
|
74
|
-
|
|
75
|
-
labelWork: chalk.white.bold(' Work:'),
|
|
76
|
-
labelGitHub: chalk.white.bold(' GitHub:'),
|
|
77
|
-
labelLinkedIn: chalk.white.bold(' LinkedIn:'),
|
|
78
|
-
labelWeb: chalk.white.bold(' Website:'),
|
|
79
|
-
labelCard: chalk.white.bold(' Card:'),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const me = boxen(
|
|
83
|
-
[
|
|
84
|
-
`${data.name}`,
|
|
85
|
-
'',
|
|
86
|
-
`${data.labelWork} ${data.work}`,
|
|
87
|
-
'',
|
|
88
|
-
`${data.labelGitHub} ${data.github}`,
|
|
89
|
-
`${data.labelLinkedIn} ${data.linkedin}`,
|
|
90
|
-
`${data.labelWeb} ${data.web}`,
|
|
91
|
-
'',
|
|
92
|
-
`${data.labelCard} ${data.npx}`,
|
|
93
|
-
'',
|
|
94
|
-
`${chalk.italic("My inbox is always open. Whether you have a")}`,
|
|
95
|
-
`${chalk.italic("question or just want to say hi, I will try")}`,
|
|
96
|
-
`${chalk.italic("my best to get back to you! :)")}`,
|
|
97
|
-
].join('\n'),
|
|
98
|
-
{
|
|
99
|
-
margin: 1,
|
|
100
|
-
float: 'center' as const,
|
|
101
|
-
padding: 1,
|
|
102
|
-
borderStyle: 'single',
|
|
103
|
-
borderColor: 'green',
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
console.log(me);
|
|
108
|
-
const tip = [`Tip: Try ${chalk.cyanBright.bold('cmd/ctrl + click')} on the links above`, ''].join('\n');
|
|
109
|
-
console.log(tip);
|
|
110
|
-
|
|
111
|
-
// Simple argument parsing
|
|
112
|
-
const argv = process.argv.slice(2);
|
|
113
|
-
if (argv.includes('--help') || argv.includes('-h')) {
|
|
114
|
-
console.log('\nUsage: npx brignano [options]\n');
|
|
115
|
-
console.log('Options:');
|
|
116
|
-
console.log(' -h, --help Show this help');
|
|
117
|
-
console.log(' -v, --view Open resume in browser (https://brignano.io/resume)');
|
|
118
|
-
console.log(' -d, --download Deprecated: previously downloaded resume — now opens resume in browser');
|
|
119
|
-
console.log(' -e, --email Open mail client to email me');
|
|
120
|
-
console.log(' --no-prompt Show card only (non-interactive)\n');
|
|
121
|
-
} else if (argv.includes('--view') || argv.includes('-v')) {
|
|
122
|
-
viewResume();
|
|
123
|
-
} else if (argv.includes('--download') || argv.includes('-d')) {
|
|
124
|
-
console.warn('Warning: `--download` is deprecated and now opens the resume in your browser.');
|
|
125
|
-
viewResume();
|
|
126
|
-
} else if (argv.includes('--email') || argv.includes('-e')) {
|
|
127
|
-
sendEmail();
|
|
128
|
-
} else if (argv.includes('--no-prompt') || argv.includes('--quiet')) {
|
|
129
|
-
console.log('\nExiting in non-interactive mode (--no-prompt).');
|
|
130
|
-
} else {
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
132
|
-
prompt(questions as any).then((answer: any) => answer.action());
|
|
133
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ES2020",
|
|
5
|
-
"declaration": false,
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"]
|
|
15
|
-
}
|