-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.ts
35 lines (29 loc) · 1.05 KB
/
index.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
import * as path from 'https://deno.land/[email protected]/path/mod.ts';
import type { IConfig } from './index.d.ts'
import * as _groups from './groups.js'
import * as _credits from './credits.js'
import * as generate from './src/generate.ts'
let decoder = new TextDecoder('utf-8')
export const config: IConfig = {
imagePath: path.resolve('./img/'),
distPath: path.resolve('./dist/'),
groups: _groups.data,
credits: _credits.data,
headerContent: decoder.decode(Deno.readFileSync('./header.html')),
footerContent: decoder.decode(Deno.readFileSync('./footer.html'))
}
for (let item of Deno.readDirSync(config.distPath))
{
if (!item.isFile && item.name != '.gitkeep')
continue;
Deno.removeSync(path.join(config.distPath, item.name))
}
let content = generate.run()
let encoder = new TextEncoder()
Deno.writeFileSync('./dist/index.html', encoder.encode(content))
for (let item of Deno.readDirSync(config.imagePath))
{
Deno.copyFileSync(
path.join(config.imagePath, item.name),
path.join(config.distPath, item.name))
}