-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (31 loc) · 856 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
34
35
36
'use strict'
let commander = require('commander'),
fs = require('fs'),
command
// Set up mongoose
require('./mongoose').start(() => {
// Set up reporter
require('./lib/reporter')
// Log ourselves
require('./lib/logger').info('run', process.argv.slice(2))
// Set up program CLI
fs.readdirSync('./lib/cli').forEach(file => {
if (/\.js$/.test(file)) {
require('./lib/cli/' + file)
}
})
commander.on('*', () => {
throw new Error('Command not found')
})
commander.option('--test-mode', 'Disable password for users "test" and "test2" (use it ONLY for running the test suite)')
command = commander.parse(process.argv).args[0]
if (!command) {
// Set up asynconnection server
// (but only if we're not executing any subcommand)
require('./lib/server').start(() => {
if (process.send) {
process.send('online')
}
})
}
})