forked from ptrstn/deepl-translate
-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbuild.ts
77 lines (72 loc) · 1.85 KB
/
build.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import fs from 'node:fs/promises'
import { request } from '@octokit/request'
const main = async () => {
/**
* @link https://github.com/sindresorhus/github-markdown-css
*/
const { data } = await request('POST /markdown', {
text: await fs.readFile('README.md', 'utf8'),
token: process.env.GITHUB_TOKEN,
})
await fs.writeFile(
'public/index.html',
/* HTML */ `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>DeepLx</title>
<link
rel="icon"
type="image/png"
href="/favicon_16.png"
sizes="16x16"
/>
<link
rel="icon"
type="image/png"
href="/favicon_32.png"
sizes="32x32"
/>
<link
rel="icon"
type="image/png"
href="/favicon_96.png"
sizes="96x96"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/apple-touch-icon.png"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/4.0.0/github-markdown.min.css"
/>
<style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style>
</head>
<body>
<article class="markdown-body">${data}</article>
</body>
</html>
`,
)
}
main().catch(console.error)