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.

49 lines
1.2 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. const ServeCommand = require('lws/lib/command/serve')
  2. const path = require('path')
  3. class WsServe extends ServeCommand {
  4. execute (options, argv) {
  5. const usage = require('lws/lib/usage')
  6. usage.defaults
  7. .set('an', 'ws')
  8. .set('av', require('../../package').version)
  9. .set('cd4', 'cli')
  10. options = {
  11. stack: require('../default-stack'),
  12. moduleDir: path.resolve(__dirname, `../../node_modules`),
  13. modulePrefix: 'lws-'
  14. }
  15. return super.execute(options, argv)
  16. }
  17. usage () {
  18. const sections = super.usage()
  19. sections.shift()
  20. sections.shift()
  21. sections.pop()
  22. sections.unshift(
  23. {
  24. header: 'local-web-server',
  25. content: 'The modular development web server for productive full-stack engineers.'
  26. },
  27. {
  28. header: 'Synopsis',
  29. content: [
  30. '$ ws <options>',
  31. '$ ws [underline]{command} <options>'
  32. ]
  33. }
  34. )
  35. sections.push({
  36. content: 'Project home: [underline]{https://github.com/lwsjs/local-web-server}'
  37. })
  38. return sections
  39. }
  40. showVersion () {
  41. const pkg = require(path.resolve(__dirname, '..', '..', 'package.json'))
  42. console.log(pkg.version)
  43. }
  44. }
  45. module.exports = WsServe