-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmanifest.ts
More file actions
50 lines (45 loc) · 1.18 KB
/
Copy pathmanifest.ts
File metadata and controls
50 lines (45 loc) · 1.18 KB
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
import { writeFileSync } from 'fs'
import { LocaleVariants } from './components/locale.js'
export let theme_color = '#000000'
export let background_color = '#ffffff'
export let manifest_files: LocaleVariants<string> = {
en: '/pwa/manifest-en.json',
zh_hk: '/pwa/manifest-zh-hk.json',
zh_cn: '/pwa/manifest-zh-cn.json',
}
export let site_names: LocaleVariants<string> = {
en: 'ts-liveview Demo',
zh_hk: 'ts-liveview 示範',
zh_cn: 'ts-liveview 示例',
}
export let short_site_names: LocaleVariants<string> = {
en: 'Demo',
zh_hk: '示範',
zh_cn: '示例',
}
for (let [_lang, url] of Object.entries(manifest_files)) {
let lang = _lang as keyof typeof manifest_files
let file = 'public' + url
let manifest = {
name: site_names[lang],
short_name: short_site_names[lang],
start_url: '/',
display: 'standalone',
orientation: 'natural',
icons: [
{
src: '/icon-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/icon-512.png',
sizes: '512x512',
type: 'image/png',
},
],
background_color,
theme_color,
}
writeFileSync(file, JSON.stringify(manifest, null, 2) + '\n')
}