mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-28 03:30:05 +00:00
Fix CI
This commit is contained in:
34
scripts/ci/build-frontend
Executable file
34
scripts/ci/build-frontend
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
BACKEND_ASSETS=backend/internal/api/handler/assets
|
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
. "$DIR/../.common.sh"
|
||||
|
||||
docker_cmd() {
|
||||
docker run --rm -e CI=true -v "$(pwd)/frontend:/app/frontend" -w /app/frontend node:14 ${*}
|
||||
}
|
||||
|
||||
cd "${DIR}/../.." || exit 1
|
||||
echo -e "${BLUE}❯ ${CYAN}Installing Frontend deps ...${RESET}"
|
||||
rm -rf frontend/node_modules
|
||||
|
||||
docker_cmd yarn install
|
||||
echo -e "${BLUE}❯ ${CYAN}Running eslint ...${RESET}"
|
||||
docker_cmd yarn eslint src
|
||||
docker_cmd yarn eslint -f junit src -o eslint.xml
|
||||
echo -e "${BLUE}❯ ${CYAN}Running tests ...${RESET}"
|
||||
docker_cmd yarn test --coverage --watchAll=false --testResultsProcessor ./node_modules/jest-junit
|
||||
echo -e "${BLUE}❯ ${CYAN}Building Frontend ...${RESET}"
|
||||
docker_cmd yarn build
|
||||
docker_cmd chown -R "$(id -u):$(id -g)" /app/frontend
|
||||
echo -e "${BLUE}❯ ${GREEN}Building Frontend Complete${RESET}"
|
||||
|
||||
# to avoid CRA ejection, just copy these build files over to embed in the backend
|
||||
cp -pr frontend/build "${BACKEND_ASSETS}"
|
||||
echo -e "${BLUE}❯ ${GREEN}Copied build to ${BACKEND_ASSETS}${RESET}"
|
||||
|
||||
rm -rf frontend/node_modules
|
||||
|
||||
trap "rm -rf frontend/node_modules" EXIT
|
Reference in New Issue
Block a user