forked from baron/baron-sso
chore: 모노레포 구축에 따른 Docker 컨테이너 및 런타임 스크립트 대응
This commit is contained in:
@@ -36,21 +36,35 @@ if [ "${1:-}" = "--print-mode" ]; then
|
||||
fi
|
||||
|
||||
ensure_frontend_dependencies() {
|
||||
if [ ! -f package.json ] || [ ! -f package-lock.json ]; then
|
||||
# If common workspace exists, manage dependencies from there
|
||||
if [ -d /common ] && [ -f /common/package.json ]; then
|
||||
WORKSPACE_DIR="/common"
|
||||
LOCK_FILE="/common/pnpm-lock.yaml"
|
||||
else
|
||||
WORKSPACE_DIR="."
|
||||
LOCK_FILE="package-lock.json"
|
||||
fi
|
||||
|
||||
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
deps_hash="$(sha256sum package.json package-lock.json | sha256sum | awk '{print $1}')"
|
||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||
else
|
||||
deps_hash="$(cksum package.json package-lock.json | cksum | awk '{print $1}')"
|
||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
||||
fi
|
||||
deps_stamp="node_modules/.baron-deps-hash"
|
||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||
|
||||
if [ "$installed_hash" != "$deps_hash" ]; then
|
||||
echo "Installing frontend dependencies from package-lock.json..."
|
||||
npm ci
|
||||
echo "Installing frontend dependencies..."
|
||||
if [ "$WORKSPACE_DIR" = "/common" ]; then
|
||||
npm install -g pnpm
|
||||
(cd /common && pnpm install)
|
||||
else
|
||||
npm ci
|
||||
fi
|
||||
mkdir -p node_modules
|
||||
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user