Files
hiring-test-one/lib/command/serve.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-06-11 19:26:47 +01:00
const ServeCommand = require('lws/lib/command/serve')
const path = require('path')
class WsServe extends ServeCommand {
execute (options, argv) {
2017-06-26 14:24:48 +01:00
const usage = require('lws/lib/usage')
2017-06-27 00:46:42 +01:00
usage.defaults
.set('an', 'ws')
.set('av', require('../../package').version)
.set('cd4', 'cli')
2017-06-11 19:26:47 +01:00
options = {
2017-07-05 12:49:26 +01:00
stack: require('../default-stack'),
2017-06-11 19:26:47 +01:00
moduleDir: path.resolve(__dirname, `../../node_modules`),
modulePrefix: 'lws-'
}
2017-07-07 23:52:48 +01:00
return super.execute(options, argv)
2017-06-11 19:26:47 +01:00
}
usage () {
const sections = super.usage()
sections.shift()
sections.shift()
sections.pop()
sections.unshift(
{
header: 'local-web-server',
2017-07-13 00:14:03 +01:00
content: 'The modular web server for productive full-stack development.'
2017-06-11 19:26:47 +01:00
},
{
header: 'Synopsis',
content: [
'$ ws <options>',
2018-04-27 21:31:36 +01:00
'$ ws {underline command} <options>'
2017-06-11 19:26:47 +01:00
]
}
)
sections.push({
2018-04-27 21:31:36 +01:00
content: 'Project home: {underline https://github.com/lwsjs/local-web-server}'
2017-06-11 19:26:47 +01:00
})
return sections
}
showVersion () {
const pkg = require(path.resolve(__dirname, '..', '..', 'package.json'))
2017-06-11 19:26:47 +01:00
console.log(pkg.version)
}
}
module.exports = WsServe