keyboard stuff
1"""Build QMK documentation locally
2"""
3import shutil
4from qmk.docs import prepare_docs_build_area, run_docs_command, BUILD_DOCS_PATH
5
6from milc import cli
7
8
9@cli.argument('-s', '--serve', arg_only=True, action='store_true', help="Serves the generated docs once built.")
10@cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
11def generate_docs(cli):
12 """Invoke the docs generation process
13
14 TODO(unclaimed):
15 * [ ] Add a real build step... something static docs
16 """
17
18 if not shutil.which('doxygen'):
19 cli.log.error('doxygen is not installed. Please install it and try again.')
20 return
21
22 if not shutil.which('yarn'):
23 cli.log.error('yarn is not installed. Please install it and try again.')
24 return
25
26 if not prepare_docs_build_area(is_production=True):
27 return False
28
29 cli.log.info('Building vitepress docs')
30 run_docs_command('run', ['docs:build'])
31 cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH)
32
33 if cli.args.serve:
34 run_docs_command('run', ['docs:preview'])