mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
Merge 79d9660812
into 36b5559b99
This commit is contained in:
commit
744c69afbe
@ -717,23 +717,26 @@ Now open your dev environment and live a squiggly-free life.
|
|||||||
|
|
||||||
## `qmk docs`
|
## `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**:
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: qmk docs [-h]
|
usage: qmk docs [-h] [-b] [-p PORT]
|
||||||
|
|
||||||
options:
|
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`
|
## `qmk generate-docs`
|
||||||
|
|
||||||
This command allows you to generate QMK documentation locally. It can be uses for general browsing or improving the docs.
|
This command generates QMK documentation for production.
|
||||||
Use the `-s`/`--serve` flag to also serve the static site once built. Default port is 4173.
|
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.
|
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:
|
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
|
## Keyboards
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ from qmk.docs import prepare_docs_build_area, run_docs_command
|
|||||||
from milc import cli
|
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)
|
@cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
|
||||||
def docs(cli):
|
def docs(cli):
|
||||||
"""Spin up a local HTTP server for the QMK docs.
|
"""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):
|
if not prepare_docs_build_area(is_production=False):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not cli.config.general.verbose:
|
cmd = ['docs:dev', '--port', f'{cli.args.port}']
|
||||||
cli.log.info('Serving docs at http://localhost:5173/ (Ctrl+C to stop)')
|
if cli.args.browser:
|
||||||
run_docs_command('run', 'docs:dev')
|
cmd.append('--open')
|
||||||
|
run_docs_command('run', cmd)
|
||||||
|
@ -27,10 +27,8 @@ def generate_docs(cli):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
cli.log.info('Building vitepress docs')
|
cli.log.info('Building vitepress docs')
|
||||||
run_docs_command('run', 'docs:build')
|
run_docs_command('run', ['docs:build'])
|
||||||
cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH)
|
cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH)
|
||||||
|
|
||||||
if cli.args.serve:
|
if cli.args.serve:
|
||||||
if not cli.config.general.verbose:
|
run_docs_command('run', ['docs:preview'])
|
||||||
cli.log.info('Serving docs at http://localhost:4173/ (Ctrl+C to stop)')
|
|
||||||
run_docs_command('run', 'docs:preview')
|
|
||||||
|
@ -17,18 +17,18 @@ BUILD_DOCS_PATH = BUILD_PATH / 'docs'
|
|||||||
DOXYGEN_PATH = BUILD_DOCS_PATH / 'static' / 'doxygen'
|
DOXYGEN_PATH = BUILD_DOCS_PATH / 'static' / 'doxygen'
|
||||||
|
|
||||||
|
|
||||||
def run_docs_command(verb, cmd=None):
|
def run_docs_command(verb, cmd_args=None):
|
||||||
environ['PATH'] += pathsep + str(NODE_MODULES_PATH / '.bin')
|
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()
|
docs_env = environ.copy()
|
||||||
if cli.config.general.verbose:
|
if cli.config.general.verbose:
|
||||||
docs_env['DEBUG'] = 'vitepress:*,vite:*'
|
docs_env['DEBUG'] = 'vitepress:*,vite:*'
|
||||||
args['env'] = docs_env
|
args['env'] = docs_env
|
||||||
|
|
||||||
arg_list = ['yarn', verb]
|
arg_list = ['yarn', verb]
|
||||||
if cmd:
|
if cmd_args:
|
||||||
arg_list.append(cmd)
|
arg_list.extend(cmd_args)
|
||||||
|
|
||||||
chdir(BUILDDEFS_PATH)
|
chdir(BUILDDEFS_PATH)
|
||||||
cli.run(arg_list, **args)
|
cli.run(arg_list, **args)
|
||||||
|
Loading…
Reference in New Issue
Block a user