Skip to content

Commit 882ed1e

Browse files
committed
refactor: clean up icons and generate twemoji at build time
1 parent b1d430c commit 882ed1e

File tree

11 files changed

+82
-12
lines changed

11 files changed

+82
-12
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ coverage
1616
.env
1717

1818
# Mac Files
19-
.DS_Store
19+
.DS_Store
20+
21+
# Generated twemoji assets (copied from node_modules at build time)
22+
src-tauri/assets/twemoji/

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"build:check": "tsc && vite build",
1111
"preview": "vite preview",
1212
"tauri": "tauri",
13-
"tauri:dev": "tauri dev",
14-
"tauri:build": "tauri build",
15-
"tauri:build:debug": "tauri build --debug",
13+
"tauri:dev": "node scripts/copy-twemoji.js && tauri dev",
14+
"tauri:build": "node scripts/copy-twemoji.js && tauri build",
15+
"tauri:build:debug": "node scripts/copy-twemoji.js && tauri build --debug",
1616
"lint": "biome check --write .",
1717
"lint:check": "biome check .",
1818
"tsc": "tsc --noEmit",

public/tauri.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.

public/vite.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/copy-twemoji.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Copies required twemoji SVG files from node_modules to src-tauri/assets.
5+
* Run this as part of the build process before `tauri build`.
6+
*/
7+
8+
import { existsSync, mkdirSync, cpSync, readdirSync } from 'node:fs';
9+
import { dirname, join } from 'node:path';
10+
import { fileURLToPath } from 'node:url';
11+
12+
const __dirname = dirname(fileURLToPath(import.meta.url));
13+
const projectRoot = join(__dirname, '..');
14+
15+
const sourceDir = join(
16+
projectRoot,
17+
'node_modules/@discordapp/twemoji/dist/svg',
18+
);
19+
const targetDir = join(projectRoot, 'src-tauri/assets/twemoji');
20+
21+
// Emoji codepoints used in the app (from constants.ts and utils/errors.ts)
22+
const REQUIRED_EMOJIS = [
23+
'1f389', // 🎉 party popper
24+
'1f38a', // 🎊 confetti ball
25+
'1f3c6', // 🏆 trophy
26+
'1f3d6', // 🏖️ beach with umbrella
27+
'1f44f', // 👏 clapping hands
28+
'1f513', // 🔓 unlocked
29+
'1f52d', // 🔭 telescope
30+
'1f60e', // 😎 smiling face with sunglasses
31+
'1f62e-200d-1f4a8', // 😮‍💨 face exhaling
32+
'1f633', // 😳 flushed face
33+
'1f643', // 🙃 upside-down face
34+
'1f648', // 🙈 see-no-evil monkey
35+
'1f64c', // 🙌 raising hands
36+
'1f680', // 🚀 rocket
37+
'1f6dc', // 🛜 wireless
38+
'1f914', // 🤔 thinking face
39+
'1f972', // 🥲 smiling face with tear
40+
'1f973', // 🥳 partying face
41+
'1fae0', // 🫠 melting face
42+
'2728', // ✨ sparkles
43+
];
44+
45+
if (!existsSync(sourceDir)) {
46+
console.error(`Source directory not found: ${sourceDir}`);
47+
console.error('Run "pnpm install" first.');
48+
process.exit(1);
49+
}
50+
51+
// Create target directory if it doesn't exist
52+
if (!existsSync(targetDir)) {
53+
mkdirSync(targetDir, { recursive: true });
54+
}
55+
56+
let copied = 0;
57+
let missing = 0;
58+
59+
for (const emoji of REQUIRED_EMOJIS) {
60+
const sourceFile = join(sourceDir, `${emoji}.svg`);
61+
const targetFile = join(targetDir, `${emoji}.svg`);
62+
63+
if (existsSync(sourceFile)) {
64+
cpSync(sourceFile, targetFile);
65+
copied++;
66+
} else {
67+
console.warn(`Missing emoji SVG: ${emoji}`);
68+
missing++;
69+
}
70+
}
71+
72+
console.log(`Copied ${copied} twemoji SVG files to ${targetDir}`);
73+
if (missing > 0) {
74+
console.warn(`${missing} emoji files were not found`);
75+
}

src-tauri/assets/twemoji/1fae0.svg

100644100755
File mode changed.

src-tauri/icons/app-icon.icns

-759 KB
Binary file not shown.

src-tauri/icons/app-icon.ico

-14.8 KB
Binary file not shown.
-96.1 KB
Binary file not shown.
-84.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)