override server stack
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
class FeatureList {
|
||||
description () {
|
||||
return 'Print installed features'
|
||||
}
|
||||
execute (options) {
|
||||
const list = [
|
||||
'lws-log',
|
||||
|
@ -1,15 +1,13 @@
|
||||
'use strict'
|
||||
const Lws = require('lws')
|
||||
const Serve = require('lws/lib/command/serve/serve')
|
||||
|
||||
/**
|
||||
* @module local-web-server
|
||||
*/
|
||||
|
||||
/**
|
||||
* @alias module:local-web-server
|
||||
*/
|
||||
class LocalWebServer extends Lws {
|
||||
constructor (options) {
|
||||
class WsServe extends Serve {
|
||||
execute (options, argv) {
|
||||
const path = require('path')
|
||||
let stack = [
|
||||
'lws-log',
|
||||
@ -27,11 +25,47 @@ class LocalWebServer extends Lws {
|
||||
'lws-index'
|
||||
]
|
||||
const moduleDir = path.resolve(__dirname, `../node_modules`)
|
||||
options = Object.assign({ stack, 'module-dir': moduleDir, 'module-prefix': 'lws-' }, options)
|
||||
super(options)
|
||||
options = {
|
||||
stack,
|
||||
'module-dir': moduleDir,
|
||||
'module-prefix': 'lws-'
|
||||
}
|
||||
super.execute(options, argv)
|
||||
}
|
||||
|
||||
/* add command */
|
||||
this.commands.set('feature-list', require('./feature-list'))
|
||||
usage () {
|
||||
const sections = super.usage()
|
||||
sections.shift()
|
||||
sections.shift()
|
||||
sections.pop()
|
||||
sections.unshift(
|
||||
{
|
||||
header: 'local-web-server',
|
||||
content: 'A convenient local web server to support productive, full-stack Javascript development.'
|
||||
},
|
||||
{
|
||||
header: 'Synopsis',
|
||||
content: [
|
||||
'$ ws <options>',
|
||||
'$ ws [underline]{command} <options>'
|
||||
]
|
||||
}
|
||||
)
|
||||
sections.push({
|
||||
content: 'Project home: [underline]{https://github.com/lwsjs/local-web-server}'
|
||||
})
|
||||
return sections
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @alias module:local-web-server
|
||||
*/
|
||||
class LocalWebServer extends Lws {
|
||||
constructor (options) {
|
||||
super (options)
|
||||
this.commands.add(null, WsServe)
|
||||
this.commands.add('feature-list', require('./feature-list'))
|
||||
}
|
||||
|
||||
getVersion () {
|
||||
@ -39,19 +73,6 @@ class LocalWebServer extends Lws {
|
||||
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
|
||||
return pkg.version
|
||||
}
|
||||
|
||||
getUsageHeader () {
|
||||
return {
|
||||
header: 'local-web-server',
|
||||
content: 'A convenient local web server to support productive, full-stack Javascript development.'
|
||||
}
|
||||
}
|
||||
|
||||
getUsageFooter () {
|
||||
return {
|
||||
content: 'Project home: [underline]{https://github.com/lwsjs/local-web-server}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = LocalWebServer
|
||||
|
@ -48,7 +48,7 @@
|
||||
"lws-mime": "^0.1.0",
|
||||
"lws-mock-response": "^0.1.0",
|
||||
"lws-rewrite": "^0.1.0",
|
||||
"lws-spa": "^0.1.0",
|
||||
"lws-spa": "^0.1.2",
|
||||
"lws-static": "^0.1.1",
|
||||
"lws": "^1.0.0-pre.4"
|
||||
},
|
||||
|
Reference in New Issue
Block a user