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.

53 lines
1.2 KiB

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