1#!/usr/bin/env bash
2# Runs at creation and on every prebuild content refresh, so codespaces start
3# with deps installed and caches warm. Everything here is idempotent.
4set -euo pipefail
5
6# Volume mounts (pnpm store, node_modules) and the directories docker creates
7# for them arrive root-owned; hand them to the dev user before installing.
8for dir in "$HOME/.cache" "$HOME/.cache/pnpm" node_modules; do
9 if [ -d "$dir" ] && [ "$(stat -c %U "$dir")" != "$(id -un)" ]; then
10 sudo chown "$(id -un):$(id -gn)" "$dir"
11 fi
12done
13
14CI=true vp i
15# Repairs electron's path.txt and exec bits after install, same as CI.
16vp run --filter @t3tools/desktop ensure:electron
17# Pre-warms Vite's dep optimizer (cache is keyed on the absolute path, which
18# is stable inside the container).
19node apps/web/scripts/warm-dep-cache.ts