lib_sxng_vite.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env bash
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. declare _Blue
  4. declare _creset
  5. vite.help(){
  6. cat <<EOF
  7. vite.: .. to be done ..
  8. simple.:
  9. build: build static files of the simple theme
  10. dev: start development server
  11. EOF
  12. }
  13. VITE_SIMPLE_THEME="${REPO_ROOT}/client/simple"
  14. # ToDo: vite server is not implemented yet / will be done in a follow up PR
  15. #
  16. # vite.simple.dev() {
  17. # ( set -e
  18. # build_msg SIMPLE "start server for FE development of: ${VITE_SIMPLE_THEME}"
  19. # pushd "${VITE_SIMPLE_THEME}"
  20. # npm install
  21. # npm exec -- vite
  22. # popd &> /dev/null
  23. # )
  24. # }
  25. vite.simple.build() {
  26. ( set -e
  27. templates.simple.pygments
  28. node.env
  29. build_msg SIMPLE "run build of theme from: ${VITE_SIMPLE_THEME}"
  30. pushd "${VITE_SIMPLE_THEME}"
  31. npm install
  32. npm run fix
  33. npm run icons.html
  34. npm run build
  35. popd &> /dev/null
  36. )
  37. }
  38. vite.simple.fix() {
  39. ( set -e
  40. node.env
  41. npm --prefix client/simple run fix
  42. )
  43. }
  44. templates.simple.pygments() {
  45. build_msg PYGMENTS "searxng_extra/update/update_pygments.py"
  46. pyenv.cmd python searxng_extra/update/update_pygments.py \
  47. | prefix_stdout "${_Blue}PYGMENTS ${_creset} "
  48. if [ "${PIPESTATUS[0]}" -ne "0" ]; then
  49. build_msg PYGMENTS "building LESS files for pygments failed"
  50. return 1
  51. fi
  52. return 0
  53. }