mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 04:43:02 +00:00
qmk docs
: restore --port
and --browser
arguments
This commit is contained in:
parent
79a661fe61
commit
2092b0a993
@ -717,23 +717,26 @@ Now open your dev environment and live a squiggly-free life.
|
||||
|
||||
## `qmk docs`
|
||||
|
||||
This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 5173.
|
||||
This command starts a local HTTP server which you can use for browsing or improving the docs, and provides live reload capability whilst editing. Default port is 8936.
|
||||
Use the `-b`/`--browser` flag to automatically open the local webserver in your default browser.
|
||||
|
||||
This command requires `node` and `yarn` to be installed as prerequisites, and provides live reload capability whilst editing.
|
||||
Requires `node` and `yarn` to be installed as prerequisites.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
usage: qmk docs [-h]
|
||||
usage: qmk docs [-h] [-b] [-p PORT]
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-h, --help show this help message and exit
|
||||
-b, --browser Open the docs in the default browser.
|
||||
-p, --port PORT Port number to use.
|
||||
```
|
||||
|
||||
## `qmk generate-docs`
|
||||
|
||||
This command allows you to generate QMK documentation locally. It can be uses for general browsing or improving the docs.
|
||||
Use the `-s`/`--serve` flag to also serve the static site once built. Default port is 4173.
|
||||
This command generates QMK documentation for production.
|
||||
Use the `-s`/`--serve` flag to also serve the static site on port 4173 once built. Note that this does not provide live reloading; use `qmk docs` instead for development purposes.
|
||||
|
||||
This command requires `node` and `yarn` to be installed as prerequisites, and requires the operating system to support symlinks.
|
||||
|
||||
|
@ -106,10 +106,10 @@ enum my_keycodes {
|
||||
Before opening a pull request, you can preview your changes if you have set up the development environment by running this command from the `qmk_firmware/` folder:
|
||||
|
||||
```
|
||||
qmk docs
|
||||
qmk docs -b
|
||||
```
|
||||
|
||||
and navigating to `http://localhost:5173/`.
|
||||
Which should automatically open your browser; otherwise, navigate to `http://localhost:8936/`.
|
||||
|
||||
## Keyboards
|
||||
|
||||
|
@ -6,6 +6,8 @@ from qmk.docs import prepare_docs_build_area, run_docs_command
|
||||
from milc import cli
|
||||
|
||||
|
||||
@cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.')
|
||||
@cli.argument('-b', '--browser', action='store_true', help='Open the docs in the default browser.')
|
||||
@cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
|
||||
def docs(cli):
|
||||
"""Spin up a local HTTP server for the QMK docs.
|
||||
@ -22,6 +24,7 @@ def docs(cli):
|
||||
if not prepare_docs_build_area(is_production=False):
|
||||
return False
|
||||
|
||||
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')
|
||||
cmd = ['docs:dev', '--port', f'{cli.args.port}']
|
||||
if cli.args.browser:
|
||||
cmd.append('--open')
|
||||
run_docs_command('run', cmd)
|
||||
|
@ -31,6 +31,4 @@ def generate_docs(cli):
|
||||
cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH)
|
||||
|
||||
if cli.args.serve:
|
||||
if not cli.config.general.verbose:
|
||||
cli.log.info('Serving docs at http://localhost:4173/ (Ctrl+C to stop)')
|
||||
run_docs_command('run', 'docs:preview')
|
||||
|
@ -20,7 +20,7 @@ DOXYGEN_PATH = BUILD_DOCS_PATH / 'static' / 'doxygen'
|
||||
def run_docs_command(verb, cmd=None):
|
||||
environ['PATH'] += pathsep + str(NODE_MODULES_PATH / '.bin')
|
||||
|
||||
args = {'capture_output': False if cli.config.general.verbose else True, 'check': True, 'stdin': DEVNULL}
|
||||
args = {'capture_output': False, 'check': True}
|
||||
docs_env = environ.copy()
|
||||
if cli.config.general.verbose:
|
||||
docs_env['DEBUG'] = 'vitepress:*,vite:*'
|
||||
@ -28,7 +28,7 @@ def run_docs_command(verb, cmd=None):
|
||||
|
||||
arg_list = ['yarn', verb]
|
||||
if cmd:
|
||||
arg_list.append(cmd)
|
||||
arg_list += cmd
|
||||
|
||||
chdir(BUILDDEFS_PATH)
|
||||
cli.run(arg_list, **args)
|
||||
|
Loading…
Reference in New Issue
Block a user