Repository URL to install this package:
Version:
0.3.0a1 ▾
|
#!/usr/bin/env bash
dist_path=${PAD_BUILD_DIR_PATH:-'build/'}
pad_dist_dir="${PAD_SRC_DIR:?}/${dist_path}"
pad_in_django_dir="${PAD_IN_DJANGO_DIR:?}"
build_cmd=${PAD_BUILD_CMD:-'npm run build'}
function build {
echo building SPA project at "${PAD_SRC_DIR}"
cd "${PAD_SRC_DIR}" && PUBLIC_URL=/${PAD_URL} BUILD_PATH=${dist_path} eval "$build_cmd"
}
function copy {
echo Copying SPA build to "${pad_in_django_dir}"
rm -rf "${pad_in_django_dir}"
cp -a "${pad_dist_dir}/." "${pad_in_django_dir}"
}
case "$1" in
b|build)
build && copy && echo Done
;;
cm|commit)
shift
commit_message="New SPA build"
if [[ -z "$1" ]] ; then
commit_message=$1
fi
git add "$pad_in_django_dir"
git commit -m "$commit_message"
;;
*)
echo "Invalid command: $1"
;;
esac