Skip to content

Commit

Permalink
Add --no-merge argument to hexdoc serve, for serving bookless plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Dec 22, 2023
1 parent 8effc93 commit 6063fbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@ Useful commands:
# show help
hexdoc -h

# render and serve the web book in watch mode
nodemon

# render and serve the web book
hexdoc serve
# serve hexdoc resources locally
# this is useful if serving other books locally that depend on hexdoc resources
nodemon --exec "hexdoc serve --port 8001 --no-merge"

# export, render, and merge the web book
hexdoc export
hexdoc render
hexdoc merge
# render and serve the Hex Casting web book in watch mode
nodemon

# start the Python interpreter with some extra local variables
hexdoc repl
Expand All @@ -72,7 +68,7 @@ nox --no-install # after the first Nox run, use this to skip reinstalling every
nox -- --snapshot-update

# run hexdoc commands in an isolated environment to ensure it works on its own
nox -s hexdoc -- export
nox -s hexdoc -- build
nox -s hexdoc -- repl

# set up a dummy book for local testing
Expand Down
20 changes: 11 additions & 9 deletions src/hexdoc/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
from textwrap import dedent
from typing import Any, Optional
from typing import Annotated, Any, Optional

from packaging.version import Version
from typer import Typer
from typer import Option, Typer
from yarl import URL

from hexdoc.core import ModResourceLoader
Expand Down Expand Up @@ -330,6 +330,7 @@ def serve(
branch: BranchOption,
try_release: bool = True,
clean: bool = False,
do_merge: Annotated[bool, Option("--merge/--no-merge")] = True,
):
book_root = dst
relative_root = book_root.resolve().relative_to(Path.cwd())
Expand Down Expand Up @@ -377,13 +378,14 @@ def serve(
clean=clean,
)

print()
logger.info("hexdoc merge")
merge(
src=src,
dst=dst,
props_file=props_file,
)
if do_merge:
print()
logger.info("hexdoc merge")
merge(
src=src,
dst=dst,
props_file=props_file,
)

print()
logger.info(f"Serving web book at {book_url} (press ctrl+c to exit)\n")
Expand Down

0 comments on commit 6063fbb

Please sign in to comment.