This project adheres to openZIM's Contribution Guidelines and openZIM's Bootstrap conventions especially its Policy.
- Don't take assigned issues. Comment if those get staled.
- If your contribution is far from trivial, open an issue to discuss it first.
- Ensure your Python code (inside scraper folder) passes
inv lintall
andinv checkall
- Ensure your Javascript code (inside zimui folder) passes
yarn format
andyarn lint
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-freecodecamp .
Scrape one or more courses (here we use the regular-expressions
course but you could use any other one of interest for your UI developments).
docker run --rm -it -v "$PWD/output":/output local-freecodecamp fcc2zim --course=regular-expressions --name tests_en_freecodecamp --zim-file tests_en_freecodecamp.zim --title "freeCodeCamp tests" --description "Test courses from freeCodeCamp" --language eng
Extract interesting ZIM content and move it to public
folder.
rm -rf zimui/public/content
docker run -it --rm -v $(pwd)/output:/data ghcr.io/openzim/zim-tools:latest zimdump dump --dir=/data/tests_en_freecodecamp /data/tests_en_freecodecamp.zim
sudo chown -R $(id -u -n):$(id -g -n) output/tests_en_freecodecamp
mv output/tests_en_freecodecamp/content zimui/public
rm -rf output/tests_en_freecodecamp
Start ZIM UI locally.
cd zimui
yarn dev
Do not forget to cleanup public/content
folder before building the docker image again, otherwise all assets will be pushed to the ZIM.
Note that some assets (e.g. icomoon fonts on LibreTexts Geoscience) having a question mark in their URL are not properly working in the yarn dev server. This is OK inside the ZIM. See openzim/mindtouch#34.
rm -rf zimui/public/content