deps.sh 635 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # Download and update deps for binary
  3. # get the directory of this script file
  4. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  5. PUBLIC=$DIR/public
  6. OUTPUT=$DIR/templats.hpp
  7. echo "// Generated file, do not edit" > $OUTPUT
  8. echo "" > $OUTPUT
  9. echo "download js bundle files"
  10. curl https://npm.reversehttp.com/@preact/signals-core,@preact/signals,htm/preact,preact,preact/hooks > $PUBLIC/index.js
  11. echo >> $PUBLIC/index.js # add newline
  12. FILES=$(ls $PUBLIC)
  13. for FILE in $FILES; do
  14. func=$(echo $FILE | tr '.' '_')
  15. echo "generate $FILE.hpp ($func)"
  16. xxd -n $func -i $PUBLIC/$FILE > $DIR/$FILE.hpp
  17. done