UNPKG

789 BJavaScriptView Raw
1#!/usr/bin/env node
2
3'use strict'
4
5const path = require('path')
6const flags = require('commander')
7
8const markserv = require(path.join(__dirname, 'server'))
9const pkg = require(path.join('..', 'package.json'))
10
11const cwd = process.cwd()
12
13flags.dir = cwd
14
15flags.version(pkg.version)
16 .usage('<file/dir>')
17 .option('-p, --port [type]', 'HTTP port [port]', 8642)
18 .option('-l, --livereloadport [type]', 'LiveReload port [livereloadport]', 35729)
19 .option('-i, --silent [type]', 'Silent (no logs to CLI)', false)
20 .option('-a, --address [type]', 'Serve on ip/address [address]', 'localhost')
21 .option('-v, --verbose', 'verbose output')
22 .action(serverPath => {
23 flags.$pathProvided = true
24 flags.dir = path.normalize(path.join(cwd, serverPath))
25 }).parse(process.argv)
26
27markserv.init(flags)