forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
develop.js
33 lines (27 loc) · 910 Bytes
/
develop.js
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
/*eslint-disable */
var program = require('commander')
var path = require('path')
var packageJson = require('../package.json')
/*eslint-enable */
// Use compiled version of code when installed globally, otherwise use
// babelscript version.
var develop // eslint-disable-line no-var
var relativeDirectory // eslint-disable-line no-var
if (require('./published')) {
develop = require('../dist/utils/develop')
} else {
develop = require('../lib/utils/develop')
}
program
.version(packageJson.version)
.option('-h, --host <url>', 'Set host. Defaults to 0.0.0.0', '0.0.0.0')
.option('-p, --port <port>', 'Set port. Defaults to 8000', '8000')
.parse(process.argv)
relativeDirectory = program.args[0]
if (!relativeDirectory) {
relativeDirectory = '.'
}
const directory = path.resolve(relativeDirectory)
program.directory = directory
program.relativeDirectory = relativeDirectory
develop(program)