代码提交

This commit is contained in:
董宏凯 committed 2026-08-16 21:48:38 +08:00
1 parent 5901246030
commit 47faa9bcdf
7 files changed
+767 -227

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <path-to-frontend-offline-deps.tar.gz>" >&2
exit 1
fi
ARCHIVE="$1"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
FRONTEND="${ROOT}/frontend-web"
if [[ ! -f "${ARCHIVE}" ]]; then
echo "Archive not found: ${ARCHIVE}" >&2
exit 1
fi
echo "Restoring frontend dependencies to ${FRONTEND} ..."
if [[ -d "${FRONTEND}/node_modules" ]]; then
rm -rf "${FRONTEND}/node_modules.bak"
mv "${FRONTEND}/node_modules" "${FRONTEND}/node_modules.bak"
echo " Existing node_modules backed up to node_modules.bak"
fi
tar -xzf "${ARCHIVE}" -C "${FRONTEND}"
for rel in node_modules/.pnpm node_modules/react/package.json node_modules/vite/package.json; do
if [[ ! -e "${FRONTEND}/${rel}" ]]; then
echo "Restore incomplete — missing ${rel}" >&2
exit 1
fi
done
echo ""
echo "Restore complete. You can now run:"
echo " cd frontend-web"
echo " pnpm dev"