docs.py 838 B

123456789101112131415161718192021222324252627
  1. """Serve QMK documentation locally
  2. """
  3. import shutil
  4. from qmk.docs import prepare_docs_build_area, run_docs_command
  5. from milc import cli
  6. @cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
  7. def docs(cli):
  8. """Spin up a local HTTP server for the QMK docs.
  9. """
  10. if not shutil.which('doxygen'):
  11. cli.log.error('doxygen is not installed. Please install it and try again.')
  12. return
  13. if not shutil.which('yarn'):
  14. cli.log.error('yarn is not installed. Please install it and try again.')
  15. return
  16. if not prepare_docs_build_area(is_production=False):
  17. return False
  18. if not cli.config.general.verbose:
  19. cli.log.info('Serving docs at http://localhost:5173/ (Ctrl+C to stop)')
  20. run_docs_command('run', 'docs:dev')