See README for details about how to install with hatch virtualenv.
When you want to alter something in the ZIM UI in Vue.JS, you need assets which are generated by the scraper (e.g. shared.json, ...).
To simplify this, it is possible to:
- run the scraper (with original code base or your modified one)
- extract assets from generated files and place them in a directory where ZIM UI will find them
- iterate on ZIM UI code
This needs to be done everytime you make significant changes to the scraper (Python code) that have impact on files used by the Vue.JS UI.
To achieve this, first build the Docker image based on current code base.
docker build -t local-maps .
In general, you will run scraper only on monaco subset so that you avoid processsing the planet mbtiles. You also want only a small Geonames subset, e.g. FR. You can for instance run the following command:
docker run --rm -it -v "$PWD/output":/output -v "$PWD/tmp":/tmp local-maps maps2zim --area monaco --geonames-region MC --name maps-tests_en_all --title "Maps Test" --description "Test ZIM for maps" --file-name "maps-tests_en_all" --default-view=43.74,7.43,13 --tmp /tmp --overwrite
Extract interesting (scraper-generated) ZIM content and move it to public folder.
rm -rf extract
docker run -it --rm -v $(pwd)/output:/data -v $(pwd)/extract:/extract ghcr.io/openzim/zim-tools:latest zimdump dump --dir=/extract /data/maps-tests_en_all.zim
sudo chown -R $(id -u -n):$(id -g -n) extract
Compile UI and copy.
cd zimui
yarn build
cd ../extract
cp -r ../scraper/src/maps2zim/zimui/* .
cd ..
Start a local server in extract folder, e.g. with python:
cd extract
python -m http.server <your_port> --bind <your_ip>
cd ..
And then open http://your_ip:your_port
Should you want to change UI code, you just need to repeat the compile UI and copy step
To clean-up:
rm -rf extract