Instructions are for unix systems. If you use Windows look into
Powershell Expand-Archive
commands alternatives for the zip sections.
cd ./ebooks/{book}
rm -f dist/{bookname}.epub
cd src-epub
zip -X0 ./{bookname}.epub mimetype
zip -r {bookname}.epub META-INF epub
Note: epub can be under name "OEBPS "depending of the original source
mv ./src-epub/{bookname}.epub ../dist
cd ./ebooks/{book}
rm -f dist/{bookname}.kepub.epub
cd src-epub
zip -X0 ./{bookname}.epub mimetype
zip -r {bookname}.kepub.epub META-INF epub
Note: epub can be under name "OEBPS "depending of the original source
mv ./src-epub/{bookname}.kepub.epub ../dist
cd ./ebooks/{book}
rm -f dist/{bookname}.azw3
cd src-azw3
zip -X0 ./{bookname}.epub mimetype
zip -r {bookname}.epub META-INF epub
Note: epub can be under name "OEBPS "depending of the original source
ebook-convert {bookname}.epub {bookname}.azw3 --pretty-print --no-inline-toc --max-toc-links=0 --prefer-metadata-cover
Will ignore complex css like clamp() and @media
mv ./{bookname}.azw3 ../dist
rm -f {bookname}.epub
cd ebooks && mkdir {book} && cd {book}
mkdir {dist,original,src-epub,ksrc-epub}
mv {path}/{bookname}.epub ./original
unzip ./original/{bookname}.epub -d ./src-epub