build.sh 574 B

1234567891011121314151617181920212223242526
  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="ignored_contracts"
  8. mkdir "$tmp_dir"
  9. # Move the ignored files to the temporary directory.
  10. while IFS="" read -r ignored
  11. do
  12. mv "contracts/$ignored" "$tmp_dir"
  13. done < contracts/.npmignore
  14. # Compile everything else.
  15. npm run compile
  16. # Return ignored files to their place.
  17. mv "$tmp_dir/"* contracts/
  18. # Delete the temporary directory.
  19. rmdir "$tmp_dir"