create-epicflare 1.0.0 → 1.2.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/index.ts +128 -5
- package/package.json +1 -1
- package/test-split.ts +20 -0
package/index.ts
CHANGED
|
@@ -2,13 +2,136 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
+
import { createInterface } from 'node:readline'
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const logoLines = [
|
|
8
|
+
' ⠀⠀⠀⠀⠀⠀⢱⣆⠀⠀⠀⠀⠀⠀',
|
|
9
|
+
' ⠀⠀⠀⠀⠀⠀⠈⣿⣷⡀⠀⠀⠀⠀',
|
|
10
|
+
' ⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣧⠀⠀⠀',
|
|
11
|
+
' ⠀⠀⠀⠀⡀⢠⣿⡟⣿⣿⣿⡇⠀⠀',
|
|
12
|
+
' ⠀⠀⠀⠀⣳⣼⣿⡏⢸⣿⣿⣿⢀⠀',
|
|
13
|
+
' ⠀⠀⠀⣰⣿⣿⡿⠁⢸⣿⣿⡟⣼⡆',
|
|
14
|
+
' ⢰⢀⣾⣿⣿⠟⠀⠀⣾⢿⣿⣿⣿⣿',
|
|
15
|
+
' ⢸⣿⣿⣿⡏⠀⠀⠀⠃⠸⣿⣿⣿⡿',
|
|
16
|
+
' ⢳⣿⣿⣿⠀⠀⠀⠀⠀⠀⢹⣿⡿⡁',
|
|
17
|
+
' ⠀⠹⣿⣿⡄⠀⠀⠀⠀⠀⢠⣿⡞⠁',
|
|
18
|
+
' ⠀⠀⠈⠛⢿⣄⠀⠀⠀⣠⠞⠋⠀⠀',
|
|
19
|
+
' ⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀',
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const textLines = [
|
|
23
|
+
' _ __ _ ',
|
|
24
|
+
' ___ _ __ (_) ___ / _| | __ _ _ __ ___ ',
|
|
25
|
+
" / _ \\ '_ \\| |/ __| |_| |/ _` | '__/ _ \\",
|
|
26
|
+
' | __/ |_) | | (__| _| | (_| | | | __/',
|
|
27
|
+
' \\___| .__/|_|\\___|_| |_|\\__,_|_| \\___|',
|
|
28
|
+
' |_| ',
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
// Split points for each line (where silver ends and orange begins)
|
|
32
|
+
// Split after the left part ends, so right part starts cleanly
|
|
33
|
+
const splitPoints = [19, 20, 20, 20, 20, 12]
|
|
34
|
+
|
|
35
|
+
function colorizeGradient(lines: string[]): string {
|
|
36
|
+
const reset = '\x1b[0m'
|
|
37
|
+
// Silver RGB: (200, 200, 200)
|
|
38
|
+
// Orange RGB: (255, 165, 0)
|
|
39
|
+
const silver = { r: 200, g: 200, b: 200 }
|
|
40
|
+
const orange = { r: 255, g: 165, b: 0 }
|
|
41
|
+
|
|
42
|
+
return lines
|
|
43
|
+
.map((line, index) => {
|
|
44
|
+
if (!line.trim()) return line
|
|
45
|
+
|
|
46
|
+
// Calculate gradient position (0 = silver at top, 1 = orange at bottom)
|
|
47
|
+
const t = index / (lines.length - 1)
|
|
48
|
+
|
|
49
|
+
// Interpolate RGB values
|
|
50
|
+
const r = Math.round(silver.r + (orange.r - silver.r) * t)
|
|
51
|
+
const g = Math.round(silver.g + (orange.g - silver.g) * t)
|
|
52
|
+
const b = Math.round(silver.b + (orange.b - silver.b) * t)
|
|
53
|
+
|
|
54
|
+
// ANSI 24-bit color code
|
|
55
|
+
const colorCode = `\x1b[38;2;${r};${g};${b}m`
|
|
56
|
+
return `${colorCode}${line}${reset}`
|
|
57
|
+
})
|
|
58
|
+
.join('\n')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function colorizeText(lines: string[], splitPoints: number[]): string {
|
|
62
|
+
const reset = '\x1b[0m'
|
|
63
|
+
// Silver gradient: lighter (220, 220, 220) to darker (160, 160, 160)
|
|
64
|
+
const silverLight = { r: 220, g: 220, b: 220 }
|
|
65
|
+
const silverDark = { r: 160, g: 160, b: 160 }
|
|
66
|
+
// Orange gradient: lighter (255, 200, 100) to darker (200, 120, 0)
|
|
67
|
+
const orangeLight = { r: 255, g: 200, b: 100 }
|
|
68
|
+
const orangeDark = { r: 200, g: 120, b: 0 }
|
|
7
69
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
70
|
+
return lines
|
|
71
|
+
.map((line, index) => {
|
|
72
|
+
if (!line.trim()) return line
|
|
73
|
+
|
|
74
|
+
const splitPoint = splitPoints[index] || line.length
|
|
75
|
+
const leftPart = line.slice(0, splitPoint)
|
|
76
|
+
const rightPart = line.slice(splitPoint)
|
|
77
|
+
|
|
78
|
+
// Calculate gradient position for this line (0 = light at top, 1 = dark at bottom)
|
|
79
|
+
const t = index / (lines.length - 1)
|
|
80
|
+
|
|
81
|
+
// Silver gradient for left part
|
|
82
|
+
const silverR = Math.round(
|
|
83
|
+
silverLight.r + (silverDark.r - silverLight.r) * t,
|
|
84
|
+
)
|
|
85
|
+
const silverG = Math.round(
|
|
86
|
+
silverLight.g + (silverDark.g - silverLight.g) * t,
|
|
87
|
+
)
|
|
88
|
+
const silverB = Math.round(
|
|
89
|
+
silverLight.b + (silverDark.b - silverLight.b) * t,
|
|
90
|
+
)
|
|
91
|
+
const silverCode = `\x1b[38;2;${silverR};${silverG};${silverB}m`
|
|
92
|
+
|
|
93
|
+
// Orange gradient for right part
|
|
94
|
+
const orangeR = Math.round(
|
|
95
|
+
orangeLight.r + (orangeDark.r - orangeLight.r) * t,
|
|
96
|
+
)
|
|
97
|
+
const orangeG = Math.round(
|
|
98
|
+
orangeLight.g + (orangeDark.g - orangeLight.g) * t,
|
|
99
|
+
)
|
|
100
|
+
const orangeB = Math.round(
|
|
101
|
+
orangeLight.b + (orangeDark.b - orangeLight.b) * t,
|
|
102
|
+
)
|
|
103
|
+
const orangeCode = `\x1b[38;2;${orangeR};${orangeG};${orangeB}m`
|
|
104
|
+
|
|
105
|
+
return `${silverCode}${leftPart}${orangeCode}${rightPart}${reset}`
|
|
106
|
+
})
|
|
107
|
+
.join('\n')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const logoArt = colorizeGradient(logoLines)
|
|
111
|
+
const textArt = colorizeText(textLines, splitPoints)
|
|
112
|
+
console.log(logoArt)
|
|
113
|
+
console.log(textArt)
|
|
114
|
+
console.log('\n\n')
|
|
115
|
+
|
|
116
|
+
const appName = process.argv[2] || (await getAppName())
|
|
117
|
+
|
|
118
|
+
function getAppName() {
|
|
119
|
+
return new Promise<string>((resolve, reject) => {
|
|
120
|
+
const rl = createInterface({
|
|
121
|
+
input: process.stdin,
|
|
122
|
+
output: process.stdout,
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
rl.question('Please provide an app name: ', (answer: string) => {
|
|
126
|
+
if (!answer.trim()) {
|
|
127
|
+
reject(new Error('App name is required.'))
|
|
128
|
+
}
|
|
129
|
+
process.argv[2] = answer.trim()
|
|
130
|
+
rl.close()
|
|
131
|
+
// Re-run the script with the provided app name.
|
|
132
|
+
resolve(answer.trim())
|
|
133
|
+
})
|
|
134
|
+
})
|
|
12
135
|
}
|
|
13
136
|
|
|
14
137
|
const commands = [
|
package/package.json
CHANGED
package/test-split.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const textLines = [
|
|
2
|
+
' _ __ _ ',
|
|
3
|
+
' ___ _ __ (_) ___ / _| | __ _ _ __ ___ ',
|
|
4
|
+
" / _ \\ '_ \\| |/ __| |_| |/ _` | '__/ _ \\",
|
|
5
|
+
' | __/ |_) | | (__| _| | (_| | | | __/',
|
|
6
|
+
' \\___| .__/|_|\\___|_| |_|\\__,_|_| \\___|',
|
|
7
|
+
' |_| ',
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
const splitPoints = [20, 20, 20, 20, 20, 12]
|
|
11
|
+
|
|
12
|
+
textLines.forEach((line, i) => {
|
|
13
|
+
const split = splitPoints[i]
|
|
14
|
+
const left = line.slice(0, split)
|
|
15
|
+
const right = line.slice(split)
|
|
16
|
+
console.log(`Line ${i + 1}:`)
|
|
17
|
+
console.log(` Left (${left.length}): "${left}"`)
|
|
18
|
+
console.log(` Right (${right.length}): "${right}"`)
|
|
19
|
+
console.log('')
|
|
20
|
+
})
|