dndbeyond_src/README.md
David Kruger bacc21e0db Create a script to keep the sourcecode up-to-date
The update.py script will push changes to a git repo when changes are
found. See the README for more details.
2025-05-30 14:06:47 -07:00

31 lines
1.1 KiB
Markdown

This is the main javascript logic from the dndbeyond.com character sheets
The data is downloaded using `sourcemapper` from https://github.com/denandz/sourcemapper
Given the main JS file URL, the source code can be downloaded and mapped using:
```
~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js
```
For convenience you can run `python update.py`
## Syncing with git repo
The script is designed to keep the contents of a git repo up-to-date with the
current files. This can be paired with a cronjob to keep an up-to-date version
of the code someplace.
To ensure the `push` phase of the update works as expected, it is recommended
to provide an SSH URL for the repository, as we can leverage an SSH key for a
password-less authentication.
The following example would keep the latest code extracted from dndbeyond.com
stored in the `ddb_src` directory on the `master` branch of the given git repo.
If changes are found they are automatically pushed to the repository,
```
python update.py \
--directory "ddb_src" \
--git-repo "ssh://git@git.example.com/test/dndbeyond_src.git"
--git-branch "master"
```