create-asciitorium 0.1.15 → 0.1.16

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
@@ -40,6 +40,21 @@ npm run cli
40
40
  npm run build
41
41
  ```
42
42
 
43
+ ### Other Scripts
44
+
45
+ Generate FIGlet ASCII art assets (placed in public/art):
46
+
47
+ ```bash
48
+ npm run figlet font "a phrase"
49
+ ```
50
+
51
+ List available FIGlet fonts:
52
+
53
+ ```bash
54
+ npm run art:fonts
55
+ ```
56
+
57
+
43
58
  ## Generated Project Structure
44
59
 
45
60
  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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-asciitorium",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "private": false,
5
5
  "description": "Scaffold a Vite + TypeScript project prewired for asciitorium (web + cli).",
6
6
  "bin": {