-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (30 loc) · 829 Bytes
/
index.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
const argv = require('minimist')(process.argv.slice(2))._;
const cmd = argv[0];
if (cmd === 'build') {
// create html files
console.log('Build site...');
const build = require('./lib/build');
build.start().then(
() => {
console.log('Done!');
},
(error) => {
console.log('Build error', error);
}
);
} else if (cmd === 'serve') {
// run static server
const { serverPort, destinationDir } = require('./lib/config')();
const StaticServer = require('static-server');
let serv = new StaticServer({
rootPath: destinationDir,
port: serverPort,
});
serv.start(() => {
console.log('Static server listening on', serverPort);
});
} else {
module.exports = {
build: require('./lib/build'),
};
}