Skip to content

Commit 00abb3c

Browse files
Fix cp -rL infinite recursion - add external deps as direct dependencies
- Add @libsql/client and better-sqlite3 as direct dependencies in apps/studio/package.json - Remove package copying logic from build-vercel.sh that caused infinite recursion - Vercel will install these packages automatically via pnpm install - Fixes build error: cp: cannot stat '../../node_modules/.pnpm/node_modules/@ai-sdk/react/react/react/...' - Update pnpm-lock.yaml Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/c8a7ff61-0ed4-46cc-ba58-56c1c0b9de42 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
1 parent de3e1ad commit 00abb3c

File tree

3 files changed

+15
-47
lines changed

3 files changed

+15
-47
lines changed

apps/studio/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@ai-sdk/openai": "^3.0.52",
2424
"@ai-sdk/react": "^3.0.160",
2525
"@hono/node-server": "^1.19.14",
26+
"@libsql/client": "^0.17.2",
2627
"@objectstack/client": "workspace:*",
2728
"@objectstack/client-react": "workspace:*",
2829
"@objectstack/driver-memory": "workspace:*",
@@ -57,6 +58,7 @@
5758
"@radix-ui/react-toast": "^1.2.15",
5859
"@radix-ui/react-tooltip": "^1.2.8",
5960
"ai": "^6.0.158",
61+
"better-sqlite3": "^12.9.0",
6062
"class-variance-authority": "^0.7.1",
6163
"clsx": "^2.1.1",
6264
"hono": "^4.12.12",

apps/studio/scripts/build-vercel.sh

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,55 +28,15 @@ cd apps/studio
2828
# 2. Bundle API serverless function
2929
node scripts/bundle-api.mjs
3030

31-
# 3. Copy native/external modules into local node_modules for Vercel packaging.
31+
# 3. External dependencies are now handled by adding them as direct dependencies
32+
# in apps/studio/package.json. Vercel installs them automatically during deployment.
3233
#
33-
# Unlike hotcrm (which uses shamefully-hoist=true), this monorepo uses pnpm's
34-
# default strict node_modules structure. Transitive native dependencies like
35-
# better-sqlite3 only exist in the monorepo root's node_modules/.pnpm/ virtual
36-
# store — they're NOT symlinked into apps/studio/node_modules/.
34+
# Packages marked as external in bundle-api.mjs (@libsql/client, better-sqlite3,
35+
# @ai-sdk/*) are listed as direct dependencies in package.json, so Vercel includes
36+
# them in the serverless function's deployment package via normal pnpm install.
3737
#
38-
# The vercel.json includeFiles pattern references node_modules/ relative to
39-
# apps/studio/, so we must copy the actual module files here for Vercel to
40-
# include them in the serverless function's deployment package.
41-
#
42-
echo "[build-vercel] Copying external native modules to local node_modules..."
43-
for mod in better-sqlite3; do
44-
src="../../node_modules/$mod"
45-
if [ -e "$src" ]; then
46-
dest="node_modules/$mod"
47-
mkdir -p "$(dirname "$dest")"
48-
cp -rL "$src" "$dest"
49-
echo "[build-vercel] ✓ Copied $mod"
50-
else
51-
echo "[build-vercel] ⚠ $mod not found at $src (skipped)"
52-
fi
53-
done
54-
# Copy the @libsql scope (includes @libsql/client and platform-specific binaries)
55-
# In pnpm monorepos, @libsql packages exist in the virtual store at node_modules/.pnpm/node_modules/@libsql
56-
if [ -d "../../node_modules/.pnpm/node_modules/@libsql" ]; then
57-
mkdir -p "node_modules/@libsql"
58-
for pkg in ../../node_modules/.pnpm/node_modules/@libsql/*/; do
59-
pkgname="$(basename "$pkg")"
60-
# Use cp -rL to dereference symlinks and copy actual files
61-
cp -rL "$pkg" "node_modules/@libsql/$pkgname"
62-
done
63-
echo "[build-vercel] ✓ Copied @libsql/*"
64-
else
65-
echo "[build-vercel] ⚠ @libsql not found (skipped)"
66-
fi
67-
# Copy the @ai-sdk scope (dynamically loaded provider packages)
68-
# In pnpm monorepos, @ai-sdk packages exist in the virtual store at node_modules/.pnpm/node_modules/@ai-sdk
69-
if [ -d "../../node_modules/.pnpm/node_modules/@ai-sdk" ]; then
70-
mkdir -p "node_modules/@ai-sdk"
71-
for pkg in ../../node_modules/.pnpm/node_modules/@ai-sdk/*/; do
72-
pkgname="$(basename "$pkg")"
73-
# Use cp -rL to dereference symlinks and copy actual files
74-
cp -rL "$pkg" "node_modules/@ai-sdk/$pkgname"
75-
done
76-
echo "[build-vercel] ✓ Copied @ai-sdk/*"
77-
else
78-
echo "[build-vercel] ⚠ @ai-sdk not found (skipped)"
79-
fi
38+
# This avoids the cp -rL infinite recursion issue that occurs when copying packages
39+
# that are already direct dependencies with circular symlinks.
8040

8141
# 4. Copy Vite build output to public/ for static file serving
8242
rm -rf public

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)