1#!/usr/bin/env bash
2# One-time container setup, baked into prebuilds. Content-dependent work
3# (dependency install, Chromium) lives in update-content.sh.
4set -euo pipefail
5
6# The Vite+ CLI is the repo task runner (vp i, vp run dev, vp test run).
7# Download to a file first: a curl failure inside $( ) would yield an empty
8# script and a false success. VP_NODE_MANAGER=no skips the installer's node
9# shims; Node comes from the devcontainer feature. The VP_*_DIR group (set
10# together, absolute) pins the install location instead of the installer's
11# XDG platform defaults, which moved the binary from ~/.vite-plus/bin to
12# ~/.local/share/vite-plus/bin between releases and would break the check
13# below either way.
14export VP_BIN_DIR="$HOME/.local/share/vite-plus/bin"
15export VP_DATA_DIR="$HOME/.local/share/vite-plus"
16export VP_CACHE_DIR="$HOME/.cache/vite-plus"
17installer=$(mktemp)
18curl -fsSL https://vite.plus -o "$installer"
19VP_NODE_MANAGER=no bash "$installer"
20rm -f "$installer"
21
22# Non-login lifecycle shells never source the profile the installer edits,
23# so expose vp on the default PATH. test -x keeps a bad install loud.
24test -x "$VP_BIN_DIR/vp"
25sudo ln -sf "$VP_BIN_DIR/vp" /usr/local/bin/vp
26
27# First-run terminal notice, rendered by the devcontainers base image.
28sudo mkdir -p /usr/local/etc/vscode-dev-containers
29sudo tee /usr/local/etc/vscode-dev-containers/first-run-notice.txt >/dev/null <<'EOF'
30T3 Code devcontainer
31
32 vp run dev start server + web, then open the pairing URL it
33 prints (the bare forwarded port will not authenticate)
34 cp .env.example .env optional: enable T3 Connect cloud features
35 (public identifiers, not secrets)
36
37Details: docs/internals/devcontainer.md
38EOF