First pass at bundling web app into service. Working.

This commit is contained in:
Gabe Kangas
2022-06-19 15:30:32 -07:00
parent 22ac8035fe
commit 78c6189c02
241 changed files with 437 additions and 178 deletions

View File

@@ -1,41 +0,0 @@
#!/usr/bin/env bash
# shellcheck disable=SC2059
set -o errexit
set -o nounset
set -o pipefail
INSTALL_TEMP_DIRECTORY="$(mktemp -d)"
PROJECT_SOURCE_DIR=$(pwd)
cd $INSTALL_TEMP_DIRECTORY
shutdown () {
rm -rf "$INSTALL_TEMP_DIRECTORY"
}
trap shutdown INT TERM ABRT EXIT
echo "Cloning owncast admin into $INSTALL_TEMP_DIRECTORY..."
git clone https://github.com/owncast/owncast-admin 2> /dev/null
cd owncast-admin
echo "Installing npm modules for the owncast admin..."
npm --silent install 2> /dev/null
echo "Building owncast admin..."
rm -rf .next
(node_modules/.bin/next build && node_modules/.bin/next export) | grep info
echo "Copying admin to project directory..."
ADMIN_BUILD_DIR=$(pwd)
cd $PROJECT_SOURCE_DIR
mkdir -p admin 2> /dev/null
cd admin
# Remove the old one
rm -rf $PROJECT_SOURCE_DIR/static/admin
# Copy over the new one
mv ${ADMIN_BUILD_DIR}/out $PROJECT_SOURCE_DIR/static/admin
shutdown
echo "Done."

28
build/web/bundleWeb.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# shellcheck disable=SC2059
set -o errexit
set -o nounset
set -o pipefail
# Change to the root directory of the repository
cd "$(git rev-parse --show-toplevel)"
cd web
echo "Installing npm modules for the owncast web..."
npm --silent install 2>/dev/null
echo "Building owncast web..."
rm -rf .next
(node_modules/.bin/next build && node_modules/.bin/next export) | grep info
echo "Copying admin to project directory..."
# Remove the old one
rm -rf ../static/web
# Copy over the new one
mv ./out ../static/web
echo "Done."