-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
build.js
27 lines (21 loc) · 869 Bytes
/
build.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
import program from 'commander'
import path from 'path'
const packageJson = require('../package.json')
// Use compiled version of code when installed globally, otherwise use babel script version.
const build = require(('./published.js') ? ('../dist/utils/build') : ('../lib/utils/build'))
program
.version(packageJson.version)
.option('--prefix-links', 'Build site with links prefixed (set prefix in your config).')
.parse(process.argv)
let relativeDirectory = program.args[0]
if (!(typeof relativeDirectory !== 'undefined' && relativeDirectory !== null)) { relativeDirectory = '.' }
const directory = path.resolve(relativeDirectory)
program.directory = directory
program.relativeDirectory = relativeDirectory
build(program, function (err) {
if ((typeof err !== 'undefined' && err !== null)) {
throw err
} else {
return console.log('Done')
}
})