2019-10-09 00:06:26 +06:00
|
|
|
"""Serve QMK documentation locally
|
|
|
|
"""
|
2021-11-05 03:02:27 +06:00
|
|
|
import shutil
|
2024-05-30 08:00:41 +06:00
|
|
|
from qmk.docs import prepare_docs_build_area, run_docs_command
|
2019-10-09 00:06:26 +06:00
|
|
|
|
|
|
|
from milc import cli
|
|
|
|
|
|
|
|
|
2020-03-24 02:59:44 +06:00
|
|
|
@cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
|
2019-10-09 00:06:26 +06:00
|
|
|
def docs(cli):
|
2021-11-05 03:02:27 +06:00
|
|
|
"""Spin up a local HTTP server for the QMK docs.
|
2019-10-09 00:06:26 +06:00
|
|
|
"""
|
2019-11-30 05:45:22 +06:00
|
|
|
|
2024-05-30 08:00:41 +06:00
|
|
|
if not shutil.which('doxygen'):
|
|
|
|
cli.log.error('doxygen is not installed. Please install it and try again.')
|
|
|
|
return
|
2019-10-09 00:06:26 +06:00
|
|
|
|
2024-05-30 08:00:41 +06:00
|
|
|
if not shutil.which('yarn'):
|
|
|
|
cli.log.error('yarn is not installed. Please install it and try again.')
|
|
|
|
return
|
2021-07-30 19:47:34 +06:00
|
|
|
|
2024-05-30 08:00:41 +06:00
|
|
|
if not prepare_docs_build_area(is_production=False):
|
|
|
|
return False
|
2021-11-05 03:02:27 +06:00
|
|
|
|
2024-05-30 08:00:41 +06:00
|
|
|
if not cli.config.general.verbose:
|
|
|
|
cli.log.info('Serving docs at http://localhost:5173/ (Ctrl+C to stop)')
|
|
|
|
run_docs_command('run', 'docs:dev')
|