mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
feat: integrate air hot-reload into devcontainer
Replace manual build+nohup with air in the `ui` command and install air during setup so .go changes auto-restart the API server.
This commit is contained in:
+6
-11
@@ -71,21 +71,16 @@ for _ in 1 2 3 4 5 6; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
# Build binary.
|
||||
printf " %-12s building..." "api"
|
||||
if ! (cd /workspace && /usr/local/go/bin/go build -o /tmp/skillshare-dev ./cmd/skillshare) 2>"$LOGDIR/ui-build.log"; then
|
||||
echo " failed (see $LOGDIR/ui-build.log)"
|
||||
exit 1
|
||||
fi
|
||||
echo " ok"
|
||||
|
||||
# Start API.
|
||||
# Start API via air (hot-reload).
|
||||
export SKILLSHARE_UI_HOST=0.0.0.0
|
||||
MODE_FLAG="-${MODE:0:1}"
|
||||
export SKILLSHARE_UI_FLAGS="${MODE_FLAG} --port ${PORT}"
|
||||
if [ "$MODE" = "project" ]; then
|
||||
cd ~/demo-project
|
||||
fi
|
||||
nohup /tmp/skillshare-dev ui "-${MODE:0:1}" --no-open --host 0.0.0.0 --port $PORT > "$LOGDIR/api-dev.log" 2>&1 &
|
||||
nohup /usr/local/go/bin/air -c /workspace/.air.toml > "$LOGDIR/api-dev.log" 2>&1 &
|
||||
echo $! > "$PIDDIR/api.pid"
|
||||
printf " %-12s started (%s mode)\n" "api" "$MODE"
|
||||
printf " %-12s started (%s mode, hot-reload)\n" "api" "$MODE"
|
||||
|
||||
# Ensure Vite is running.
|
||||
if is_port_open $VITE_PORT; then
|
||||
|
||||
@@ -27,11 +27,15 @@ PROFILE_EOF
|
||||
echo "▸ Building skillshare binary …"
|
||||
make build
|
||||
|
||||
# ── 1a. Ensure Linux binary + stable command symlinks ─────────────
|
||||
# ── 1a. Install air (Go hot-reload) ─────────────────────────────
|
||||
echo "▸ Installing air (hot-reload) …"
|
||||
go install github.com/air-verse/air@latest
|
||||
|
||||
# ── 1b. Ensure Linux binary + stable command symlinks ─────────────
|
||||
echo "▸ Verifying skillshare command targets …"
|
||||
./.devcontainer/ensure-skillshare-linux-binary.sh
|
||||
|
||||
# ── 1b. Install frontend dependencies ─────────────────────────────
|
||||
# ── 1c. Install frontend dependencies ─────────────────────────────
|
||||
echo "▸ Installing UI dependencies …"
|
||||
(cd /workspace/ui && pnpm install --frozen-lockfile)
|
||||
echo "▸ Installing website dependencies …"
|
||||
|
||||
Reference in New Issue
Block a user