create-asciitorium 0.1.15 → 0.1.17
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/README.md
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
|
|
15
15
|
### Installation
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
The recommended way to start a new project is with the npm create command:
|
|
19
18
|
|
|
20
19
|
```bash
|
|
@@ -40,6 +39,20 @@ npm run cli
|
|
|
40
39
|
npm run build
|
|
41
40
|
```
|
|
42
41
|
|
|
42
|
+
### Other Scripts
|
|
43
|
+
|
|
44
|
+
Generate FIGlet ASCII art assets (placed in public/art):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run figlet font "a phrase"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
List available FIGlet fonts:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run figlet:fonts
|
|
54
|
+
```
|
|
55
|
+
|
|
43
56
|
## Generated Project Structure
|
|
44
57
|
|
|
45
58
|
A typical generated project will look like:
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
"web": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
9
|
"preview": "vite preview",
|
|
10
|
-
"cli": "tsx src/main.tsx"
|
|
10
|
+
"cli": "tsx src/main.tsx",
|
|
11
|
+
"figlet": "node scripts/gen-figlet-art.js",
|
|
12
|
+
"figlet:fonts": "node -e 'require(\"figlet\").fonts((_, f) => console.log(f.join(\"\\n\")))'"
|
|
11
13
|
},
|
|
12
14
|
"devDependencies": {
|
|
13
15
|
"typescript": "^5.5.4",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import figlet from 'figlet';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
// ─── Parse CLI Arguments ──────────────────────────────────────────
|
|
7
|
+
const [font, ...phraseParts] = process.argv.slice(2);
|
|
8
|
+
const phrase = phraseParts.join(' ');
|
|
9
|
+
|
|
10
|
+
if (!font || !phrase) {
|
|
11
|
+
console.error('Usage: node scripts/generate-art.js <font> <phrase>');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// ─── Generate ASCII Art ───────────────────────────────────────────
|
|
16
|
+
figlet.text(phrase, { font }, (err, data) => {
|
|
17
|
+
if (err || !data) {
|
|
18
|
+
console.error('❌ Failed to generate ASCII art:', err || 'Unknown error');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const safeFilename = phrase.replace(/[^a-z0-9_-]+/gi, '_');
|
|
23
|
+
const outputPath = path.join(
|
|
24
|
+
__dirname,
|
|
25
|
+
'../public/art',
|
|
26
|
+
`${safeFilename}.txt`
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
fs.ensureDirSync(path.dirname(outputPath));
|
|
30
|
+
fs.writeFileSync(outputPath, data);
|
|
31
|
+
|
|
32
|
+
console.log(`✅ Generated: art/${safeFilename}.txt`);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TextInput,
|
|
9
9
|
PerfMonitor,
|
|
10
10
|
CelticBorder,
|
|
11
|
-
|
|
11
|
+
HR,
|
|
12
12
|
loadAsciiAsset
|
|
13
13
|
} from 'asciitorium';
|
|
14
14
|
|
|
@@ -23,21 +23,21 @@ const titleArt = await loadAsciiAsset('./art/asciitorium.txt');
|
|
|
23
23
|
// Construct the app
|
|
24
24
|
const app = (
|
|
25
25
|
<App width={appWidth} height={appHeight} layout="relaxed">
|
|
26
|
-
<CelticBorder
|
|
27
|
-
<CelticBorder
|
|
28
|
-
<CelticBorder edge="bottom-left" align="bottom-left" />
|
|
29
|
-
<CelticBorder edge="bottom-right" align="bottom-right" />
|
|
26
|
+
<CelticBorder align="top-left" />
|
|
27
|
+
<CelticBorder align="top-right" />
|
|
30
28
|
|
|
31
29
|
<Box align="top" layout="vertical" gap={2}>
|
|
32
30
|
<AsciiArt content={titleArt} align="top" />
|
|
33
|
-
<
|
|
34
|
-
<Text
|
|
31
|
+
<HR length={48} align="center" />
|
|
32
|
+
<Text align="top" gap={3}>a ui framework for cli and web</Text>
|
|
35
33
|
</Box>
|
|
36
34
|
|
|
37
35
|
<TextInput label="TextInput:" width={30} value={helloWorld} gap={2} align="center" />
|
|
38
36
|
|
|
39
37
|
<Text value={helloWorld} width={appWidth - 24} align="bottom" gap={8} />
|
|
40
|
-
|
|
38
|
+
|
|
39
|
+
<CelticBorder align="bottom-left" />
|
|
40
|
+
<CelticBorder align="bottom-right" />
|
|
41
41
|
</App>
|
|
42
42
|
);
|
|
43
43
|
|