forked from Project-N-E-K-O/N.E.K.O
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_frontend.sh
More file actions
executable file
·80 lines (66 loc) · 2.08 KB
/
build_frontend.sh
File metadata and controls
executable file
·80 lines (66 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
# Build all frontend projects.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if ! command -v npm &> /dev/null; then
echo "[build_frontend] npm not found, please install Node.js" >&2
exit 1
fi
# --- 0. yui-origin Live2D model (unpack from assets/) ---
YUI_ARCHIVE="$SCRIPT_DIR/assets/yui-origin.tar.gz"
YUI_DIR="$SCRIPT_DIR/static/yui-origin"
YUI_MARKER="$YUI_DIR/yui-origin.moc3"
if [ ! -f "$YUI_ARCHIVE" ]; then
echo "[build_frontend] yui-origin archive missing: $YUI_ARCHIVE" >&2
exit 1
fi
if [ ! -f "$YUI_MARKER" ] || [ "$YUI_ARCHIVE" -nt "$YUI_MARKER" ]; then
echo "[build_frontend] unpacking yui-origin..."
rm -rf "$YUI_DIR"
tar -xzmf "$YUI_ARCHIVE" -C "$SCRIPT_DIR/static"
if [ ! -f "$YUI_MARKER" ]; then
echo "[build_frontend] yui-origin marker missing after unpack: $YUI_MARKER" >&2
exit 1
fi
echo "[build_frontend] yui-origin done: $YUI_DIR"
else
echo "[build_frontend] yui-origin up to date, skip"
fi
# --- 1. Plugin Manager (Vue) ---
PM_DIR="$SCRIPT_DIR/frontend/plugin-manager"
PM_DIST="$PM_DIR/dist"
if [ ! -d "$PM_DIR" ]; then
echo "[build_frontend] plugin-manager dir not found: $PM_DIR" >&2
exit 1
fi
echo "[build_frontend] building plugin-manager..."
(
cd "$PM_DIR"
npm ci
npm run build-only
)
if [ ! -f "$PM_DIST/index.html" ]; then
echo "[build_frontend] plugin-manager build output missing: $PM_DIST/index.html" >&2
exit 1
fi
echo "[build_frontend] plugin-manager done: $PM_DIST"
# --- 2. React Neko Chat ---
RC_DIR="$SCRIPT_DIR/frontend/react-neko-chat"
RC_DIST="$SCRIPT_DIR/static/react/neko-chat"
if [ ! -d "$RC_DIR" ]; then
echo "[build_frontend] react-neko-chat dir not found: $RC_DIR" >&2
exit 1
fi
echo "[build_frontend] building react-neko-chat..."
(
cd "$RC_DIR"
npm ci
npm run build
)
if [ ! -f "$RC_DIST/neko-chat-window.iife.js" ]; then
echo "[build_frontend] react-neko-chat build output missing: $RC_DIST/neko-chat-window.iife.js" >&2
exit 1
fi
echo "[build_frontend] react-neko-chat done: $RC_DIST"
echo ""
echo "[build_frontend] all frontend projects built successfully."