dnote/scripts/web/setup.sh
Sung Won Cho 2124e28a9f
Use go module (#303)
* Migrate to gomodule

* Fix install

* Update makefile
2019-11-11 15:28:47 +08:00

22 lines
631 B
Bash
Executable file

#!/usr/bin/env bash
# setup.sh prepares the directory structure and copies static files
set -eux -o pipefail
dir=$(dirname "${BASH_SOURCE[0]}")
basePath="$dir/../.."
publicPath=$PUBLIC_PATH
compiledPath=$COMPILED_PATH
assetBaseUrl=$ASSET_BASE_URL
# prepare directories
rm -rf "$compiledPath"
rm -rf "$publicPath"
mkdir -p "$compiledPath"
mkdir -p "$publicPath"
# copy the assets and artifacts
cp -r "$basePath"/web/assets/* "$publicPath"
# populate placeholders
assetBaseUrlEscaped=$(echo "$assetBaseUrl" | sed -e 's/[\/&]/\\&/g')
sed -i -e "s/ASSET_BASE_PLACEHOLDER/$assetBaseUrlEscaped/g" "$publicPath"/static/manifest.json