deps.sh 807 B

123456789101112131415161718192021222324252627
  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. echo "download js bundle files"
  7. curl https://npm.reversehttp.com/@preact/signals-core,@preact/signals,htm/preact,preact,preact/hooks > $PUBLIC/index.js
  8. echo >> $PUBLIC/index.js # add newline
  9. FILES=$(ls $PUBLIC)
  10. cd $PUBLIC
  11. for FILE in $FILES; do
  12. echo "generate $FILE.hpp"
  13. # Use C++11 string literals instead of ugly xxd.
  14. f=$(echo $FILE | sed 's/\./_/g' -e 's/-/_/g')
  15. echo "const char $f[] = R\"LITERAL(" > $DIR/$FILE.hpp
  16. cat $FILE >> $DIR/$FILE.hpp
  17. echo ")LITERAL\";" >> $DIR/$FILE.hpp
  18. echo "unsigned int ${f}_len = sizeof($f);" >> $DIR/$FILE.hpp
  19. #Deprecated old xxd
  20. #xxd -i $FILE > $DIR/$FILE.hpp
  21. done