build: add reusable build_website.sh script
This commit is contained in:
21
rust/build_website.sh
Executable file
21
rust/build_website.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
WEBPACK_DIR="${SCRIPT_DIR}/src_webpack"
|
||||||
|
WEBSERVER_DIR="${SCRIPT_DIR}/src/webserver"
|
||||||
|
|
||||||
|
rm -f "${WEBSERVER_DIR}/index.html.gz"
|
||||||
|
rm -f "${WEBSERVER_DIR}/bundle.js.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/index.html.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/bundle.js.gz"
|
||||||
|
rm -f "${WEBPACK_DIR}/index.html"
|
||||||
|
rm -f "${WEBPACK_DIR}/bundle.js"
|
||||||
|
|
||||||
|
pushd "${WEBPACK_DIR}"
|
||||||
|
npm install
|
||||||
|
npx webpack build
|
||||||
|
cp index.html.gz "${WEBSERVER_DIR}/index.html.gz"
|
||||||
|
cp bundle.js.gz "${WEBSERVER_DIR}/bundle.js.gz"
|
||||||
|
popd
|
||||||
Reference in New Issue
Block a user