|
|
@ -1,6 +1,7 @@ |
|
|
|
'use strict' |
|
|
|
const Lws = require('lws') |
|
|
|
const Serve = require('lws/lib/command/serve/serve') |
|
|
|
const Serve = require('lws/lib/command/serve') |
|
|
|
const path = require('path') |
|
|
|
|
|
|
|
/** |
|
|
|
* @module local-web-server |
|
|
@ -8,8 +9,8 @@ const Serve = require('lws/lib/command/serve/serve') |
|
|
|
|
|
|
|
class WsServe extends Serve { |
|
|
|
execute (options, argv) { |
|
|
|
const path = require('path') |
|
|
|
let stack = [ |
|
|
|
options = { |
|
|
|
stack: [ |
|
|
|
'lws-log', |
|
|
|
'lws-cors', |
|
|
|
'lws-json', |
|
|
@ -23,11 +24,8 @@ class WsServe extends Serve { |
|
|
|
'lws-spa', |
|
|
|
'lws-static', |
|
|
|
'lws-index' |
|
|
|
] |
|
|
|
const moduleDir = path.resolve(__dirname, `../node_modules`) |
|
|
|
options = { |
|
|
|
stack, |
|
|
|
moduleDir, |
|
|
|
], |
|
|
|
moduleDir: path.resolve(__dirname, `../node_modules`), |
|
|
|
modulePrefix: 'lws-' |
|
|
|
} |
|
|
|
super.execute(options, argv) |
|
|
@ -64,12 +62,13 @@ class WsServe extends Serve { |
|
|
|
class LocalWebServer extends Lws { |
|
|
|
constructor (options) { |
|
|
|
super (options) |
|
|
|
/* override default serve command */ |
|
|
|
this.commands.add(null, WsServe) |
|
|
|
/* add feature-list command */ |
|
|
|
this.commands.add('feature-list', require('./feature-list')) |
|
|
|
} |
|
|
|
|
|
|
|
getVersion () { |
|
|
|
const path = require('path') |
|
|
|
const pkg = require(path.resolve(__dirname, '..', 'package.json')) |
|
|
|
return pkg.version |
|
|
|
} |
|
|
|