Development#
This page describes how to set up t-doc for development. It isn't necessary for creating and editing documents.
Install#
Install the required packages for your system.
Install Node.js, include the
npmpackage manager and make sure it's on the systemPATH.winget install --id OpenJS.NodeJS.LTSInstall Node.js manually or via a package manager like Homebrew
Install Node.js via your system's package manager.
Clone the
commonrepository.hg clone -u main https://rc.t-doc.org/hg/common cd common
Run the local server as usual. This installs the
t-doc-commonpackage as editable into the virtual environment_venv/dev.
Upgrade#
Pull missing changesets from the
commonrepository.hg pullUpdate to the branch head.
hg update --checkUpdate the generated files.
run.py uv build./run.py uv build./run.py uv buildIf any Python dependencies need to be upgraded, delete the
_venv/devdirectory. It will be re-created when the local server is run the next time.
Run#
Commands can be run with the development setup via its run.py script. The
script runs commands within the
virtual environment installed
into _venv.
Run the local server with debug settings, as specified by the
command-devdefault defined inrun.toml.run.py./run.py./run.pyRun the local server against a specific site. The command below assumes that the site checkout is in the same directory as the
commoncheckout.├── common └── site
cd site ..\common\run.py
cd site ../common/run.py
cd site ../common/run.py
To make the local server trigger a rebuild whenever code within
commonchanges, add the following line to the[defaults]section ofrun.local.toml. This is useful when working on code related to building sites or on client-side code.command-dev_20 = ["--watch=../common/tdoc"]
To make the local server restart for each rebuild, add the following line to the
[defaults]section ofrun.local.toml. This is useful when working on the local server itself or on API code.command-dev_21 = ["--restart-on-change"]
Create a persistent database for the local server. This requires configuring the path to the database in the
[store]section oftdoc.local.toml.[store] path = "tmp/store.sqlite"
run.py tdoc store create --dev./run.py tdoc store create --dev./run.py tdoc store create --devGet help for
tdocsub-commands.run.py tdoc --help./run.py tdoc --help./run.py tdoc --help