yechancho 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/index.js +134 -1
  2. package/package.json +12 -2
package/index.js CHANGED
@@ -1,3 +1,136 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict'
3
- console.log("yoo its yechan")
3
+
4
+ import boxen from 'boxen'
5
+ import chalk from 'chalk'
6
+ import gradient from 'gradient-string'
7
+ import figlet from 'figlet'
8
+ import terminalLink from 'terminal-link'
9
+ import logUpdate from 'log-update'
10
+ import ansiEscapes from 'ansi-escapes'
11
+ import cliCursor from 'cli-cursor'
12
+
13
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms))
14
+
15
+ const sakura = {
16
+ pink: chalk.hex('#FFB7C5'),
17
+ blossom: chalk.hex('#FFD7E5'),
18
+ rose: chalk.hex('#FF6FAE'),
19
+ lilac: chalk.hex('#C7A2FF'),
20
+ sky: chalk.hex('#7FD1FF'),
21
+ mint: chalk.hex('#8CFFDB'),
22
+ dim: chalk.hex('#9AA0A6'),
23
+ }
24
+
25
+ const links = [
26
+ {
27
+ label: 'LinkedIn',
28
+ url: 'https://www.linkedin.com/in/yechancho5',
29
+ icon: '❀',
30
+ },
31
+ {
32
+ label: 'Github',
33
+ url: 'https://www.github.com/in/yechancho5',
34
+ icon: '❀',
35
+ },
36
+ ]
37
+
38
+ const supportsLinks = terminalLink.isSupported
39
+
40
+ const makeHeader = () => {
41
+ const text = figlet.textSync('YECHAN', { font: 'ANSI Shadow', horizontalLayout: 'default' })
42
+ return gradient(['#FFB7C5', '#FFD7E5', '#C7A2FF'])(text)
43
+ }
44
+
45
+ const makeBody = () => {
46
+ const bio =
47
+ sakura.blossom("hi, i'm yechan ") +
48
+ sakura.dim('— ') +
49
+ sakura.pink('i build things ') +
50
+ sakura.dim('• ') +
51
+ sakura.lilac('full-stack') +
52
+ sakura.dim(' • ') +
53
+ sakura.sky('systems') +
54
+ '\n'
55
+
56
+ const line = sakura.dim('─'.repeat(36))
57
+
58
+ const linkLines = links
59
+ .map(({ label, url, icon }) => {
60
+ const left = sakura.rose(` ${icon} `) + sakura.pink(`${label}:`).padEnd(12)
61
+ const right = supportsLinks ? terminalLink(sakura.sky(url), url) : sakura.sky(url)
62
+ return left + ' ' + right
63
+ })
64
+ .join('\n')
65
+
66
+ const footer =
67
+ '\n' +
68
+ sakura.dim('say hi: ') +
69
+ sakura.mint('yechancho') +
70
+ sakura.dim(' @ npm') +
71
+ ' ' +
72
+ sakura.rose('🌸')
73
+
74
+ return [bio, line, linkLines, footer].join('\n')
75
+ }
76
+
77
+ const makeCard = () => {
78
+ const content = `${makeHeader()}\n\n${makeBody()}`
79
+ return boxen(content, {
80
+ padding: 1,
81
+ margin: 1,
82
+ borderStyle: 'round',
83
+ borderColor: 'magenta',
84
+ })
85
+ }
86
+
87
+ function renderPetalsFrame(card, frame, width = 60, height = 12) {
88
+ const petals = ['🌸', '✿', '❀', '·']
89
+ const cols = width
90
+ const rows = height
91
+
92
+ const points = []
93
+ for (let i = 0; i < 18; i++) {
94
+ const x = (i * 7 + frame * 3) % cols
95
+ const y = (i * 3 + frame) % rows
96
+ const ch = petals[(i + frame) % petals.length]
97
+ points.push({ x, y, ch })
98
+ }
99
+
100
+ const grid = Array.from({ length: rows }, () => Array.from({ length: cols }, () => ' '))
101
+ for (const p of points) grid[p.y][p.x] = p.ch
102
+
103
+ const overlay = grid.map((r) => r.join('')).join('\n')
104
+ const tinted = sakura.blossom(overlay)
105
+
106
+ return tinted + '\n' + card
107
+ }
108
+
109
+ async function main() {
110
+ const card = makeCard()
111
+
112
+ if (process.argv.includes('--static')) {
113
+ console.log(card)
114
+ return
115
+ }
116
+
117
+ cliCursor.hide()
118
+ process.stdout.write(ansiEscapes.clearScreen)
119
+
120
+ const frames = 28
121
+ for (let f = 0; f < frames; f++) {
122
+ logUpdate(renderPetalsFrame(card, f))
123
+ await sleep(45)
124
+ }
125
+
126
+ logUpdate.clear()
127
+ cliCursor.show()
128
+ console.log(card)
129
+ console.log(sakura.dim('Tip: run with ') + sakura.pink('--static') + sakura.dim(' to disable animation.'))
130
+ }
131
+
132
+ main().catch((e) => {
133
+ cliCursor.show()
134
+ console.error(e)
135
+ process.exit(1)
136
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yechancho",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "yechancho's terminal card",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -11,5 +11,15 @@
11
11
  },
12
12
  "keywords": [],
13
13
  "author": "",
14
- "license": "ISC"
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "ansi-escapes": "^7.3.0",
17
+ "boxen": "^8.0.1",
18
+ "chalk": "^5.6.2",
19
+ "cli-cursor": "^5.0.0",
20
+ "figlet": "^1.10.0",
21
+ "gradient-string": "^3.0.0",
22
+ "log-update": "^7.1.0",
23
+ "terminal-link": "^5.0.0"
24
+ }
15
25
  }