-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wxt.config.ts
59 lines (53 loc) 路 1.33 KB
/
wxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { defineConfig } from 'wxt';
import { hfs } from '@humanfs/node';
import { join } from 'path';
import { optimize } from 'svgo';
import jiti from 'jiti';
export default defineConfig({
srcDir: 'src',
entrypointsDir: 'entries',
outDir: 'dist',
manifest: {
name: 'Catppuccin for GitHub File Explorer Icons',
permissions: ['storage'],
homepage_url:
'https://github.com/catppuccin/github-file-explorer-icons',
},
hooks: {
'build:before': async () => {
const ICON_DIR = join(
__dirname,
'./vscode-icons/icons/css-variables/',
);
const icons = {};
for await (const entry of hfs.list(ICON_DIR)) {
icons[entry.name.replace('.svg', '')] = await hfs
.text(join(ICON_DIR, entry.name))
.then((text) => {
return optimize(
text.replaceAll('--vscode-ctp', '--ctp'),
{
js2svg: { useShortTags: false },
},
)
.data.replace(
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">',
'',
)
.replace('</svg>', '');
});
}
await hfs.write(
join(__dirname, './src/icons.json'),
JSON.stringify(icons),
);
await hfs.write(
join(__dirname, './src/associations.json'),
JSON.stringify(
jiti(__dirname)('./vscode-icons/src/defaults/index.ts')
.defaultConfig.associations,
),
);
},
},
});