1
0

build.sh 906 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. exec 2>&1
  3. # If the repo is not there then we have nothing to build. Exit
  4. #[ ! -d "./peerjs" ] && echo "PeerJS source code not found at ./peerjs. Clone it from https://github.com/peers/peerjs.git" && exit
  5. # If the repo is not there clone it so we can build it.
  6. [ ! -d "./peerjs" ] && git clone https://github.com/peers/peerjs.git peerjs
  7. rm -rf dist/
  8. cd peerjs
  9. # Generate a file documenting the changes made to peerjs source code for future reference
  10. git diff -- . ':(exclude)dist/*' > ../patch/base_code_changes.diff
  11. # Build the existing peerjs project into ../dist
  12. ../node_modules/.bin/parcel build --no-source-maps lib/exports.ts -d ../dist --out-file peerjs.min.js
  13. cd ../
  14. # Append some of our modifications onto the built peerjs code
  15. cat patch/header_patch.js dist/peerjs.min.js patch/footer_patch.js > dist/peerjs-on-node.js
  16. rm dist/peerjs.min.js
  17. echo "Done. dist/peerjs-on-node.js"