#! /bin/sh function fail() { echo "ERROR: $1" exit 1 } function cpy_css() { cp "src/apps/watlas/$1.css" ../ || fail "Cannot copy $1.css" } cd molstar || fail "Cannot cd into molstar directory" npm install molstar || fail "Cannot install modules required to build Molstar" npm run build || fail "Failed to build Molstar" cp build/watlas/molstar.js ../ || fail "Cannot copy molstar.js" cpy_css "molstar" cpy_css "watlas-viewer"