-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.ts
executable file
·32 lines (28 loc) · 964 Bytes
/
dev.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
#!/usr/bin/env -S deno run -A --watch=static/,routes/,posts/
import { Builder } from 'fresh/dev'
import { app } from './main.ts'
import { tailwind } from '@fresh/plugin-tailwind'
import { saveSitemapAndRobots } from 'fresh-sitemap'
import { appInfo } from '@/config.ts'
import { generateDatePostsIndex } from '@/scripts/generateNewsIndex.ts'
const builder = new Builder({ target: 'safari12' })
tailwind(builder, app, {})
await generateDatePostsIndex({
kind: 'news',
path: 'posts/news',
exportPath: 'generated/newsPostsIndex.ts',
languages: ['en', 'ja'],
})
if (Deno.args.includes('build')) {
await saveSitemapAndRobots({
basename: `https://${appInfo.domain}`,
distDirectory: 'routes',
postsDirectory: 'posts',
sitemapPath: 'static/sitemap.xml',
robotsPath: 'static/robots.txt',
options: { languages: ['en', 'ja'], defaultLanguage: 'en' },
})
await builder.build(app)
} else {
await builder.listen(app, { port: 4200 })
}