build.sh 572 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. # Configure to exit script as soon as a command fails.
  3. set -o errexit
  4. # Clean the existing build directory.
  5. rm -rf build
  6. # Create a temporary directory to place ignored files (e.g. examples).
  7. tmp_dir="$(mktemp -dp.)"
  8. # Move the ignored files to the temporary directory.
  9. while IFS="" read -r ignored
  10. do
  11. mv "contracts/$ignored" "$tmp_dir"
  12. done < contracts/.npmignore
  13. # Compile everything else.
  14. node_modules/.bin/truffle compile
  15. # Return ignored files to their place.
  16. mv "$tmp_dir/"* contracts/
  17. # Delete the temporary directory.
  18. rmdir "$tmp_dir"