You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.5 KiB
62 lines
1.5 KiB
const LwsCli = require('lws/lib/cli-app')
|
|
const path = require('path')
|
|
|
|
class WsCli extends LwsCli {
|
|
execute (options) {
|
|
if (options.defaultStack) {
|
|
const list = require('./default-stack')
|
|
this.log(list)
|
|
} else {
|
|
return super.execute(options)
|
|
}
|
|
}
|
|
|
|
getDefaultOptions () {
|
|
return Object.assign(super.getDefaultOptions(), {
|
|
stack: require('./default-stack').slice(),
|
|
moduleDir: [ path.resolve(__dirname, '..'), '.' ]
|
|
})
|
|
}
|
|
|
|
partialDefinitions () {
|
|
return super.partialDefinitions().concat([
|
|
{
|
|
name: 'default-stack',
|
|
type: Boolean,
|
|
description: 'Print the default middleware stack. Any of these built-in middlewares are available to use in a custom stack.',
|
|
section: 'core'
|
|
}
|
|
])
|
|
}
|
|
|
|
usage () {
|
|
const sections = super.usage()
|
|
sections.shift()
|
|
sections.shift()
|
|
sections.pop()
|
|
sections.unshift(
|
|
{
|
|
header: 'local-web-server',
|
|
content: 'The modular web server for productive full-stack 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
|
|
}
|
|
|
|
showVersion () {
|
|
const pkg = require(path.resolve(__dirname, '..', 'package.json'))
|
|
this.log(pkg.version)
|
|
}
|
|
}
|
|
|
|
module.exports = WsCli
|