-
Notifications
You must be signed in to change notification settings - Fork 170
/
dev.ts
25 lines (21 loc) · 1.01 KB
/
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
import { Application } from '../server/app.ts'
import { serve } from '../server/stdserver.ts'
import { getFlag, parsePortNumber } from '../shared/flags.ts'
export const helpMessage = `
Usage:
aleph dev <dir> [...options]
<dir> represents the directory of Aleph.js app,
if the <dir> is empty, the current directory will be used.
Options:
-p, --port <port> A port number to start the Aleph.js app, default is 8080
--hostname <hostname> The address at which the server is to be started
-L, --log-level <log-level> Set log level [possible values: debug, info]
-r, --reload Reload source code cache
-h, --help Prints help message
`
export default async function (workingDir: string, flags: Record<string, any>) {
const app = new Application(workingDir, 'development', Boolean(flags.r || flags.reload))
const hostname = getFlag(flags, ['hostname'])
const port = parsePortNumber(getFlag(flags, ['p', 'port'], '8080'))
await serve({ app, port, hostname })
}