ci(docker-deploy): symlink packages/db node_modules into scripts/
CI / Architecture Guardrails (push) Successful in 2m37s
CI / Typecheck (push) Successful in 3m22s
CI / Assistant Split Regression (push) Successful in 4m48s
CI / Lint (push) Successful in 5m17s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has started running
CI / Unit Tests (push) Has started running

Node's ESM bare-specifier resolver walks up from the script's
directory and ignores NODE_PATH (that's CJS-only). Create
scripts/node_modules with symlinks to @prisma, @node-rs, and
.prisma from packages/db/node_modules so setup-admin.mjs's imports
resolve on the first step up.
This commit is contained in:
2026-04-13 00:25:36 +02:00
parent d6df582e5e
commit e6b11120ab
+13 -5
View File
@@ -463,13 +463,21 @@ jobs:
- name: Seed admin user
# setup-admin.mjs imports @prisma/client and @node-rs/argon2, both of
# which live only in packages/db/node_modules under pnpm workspaces.
# Node's bare-specifier resolution walks up from the *script's*
# directory (/app/scripts), not cwd, and the root /app/node_modules
# has neither. NODE_PATH adds packages/db/node_modules as a fallback
# resolution root so the imports succeed.
# Node's ESM bare-specifier resolver walks up from the *script's*
# directory (/app/scripts), not cwd, and NODE_PATH is a CJS-only
# escape hatch (ignored by ESM). Create a scripts/node_modules with
# symlinks to the real package directories so the resolver finds
# them on the first step up.
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml exec -T app \
sh -c 'NODE_PATH=/app/packages/db/node_modules node /app/scripts/setup-admin.mjs --email admin@capakraken.dev --name Admin --password admin123'
sh -c '
set -e
mkdir -p /app/scripts/node_modules
ln -sfn /app/packages/db/node_modules/@prisma /app/scripts/node_modules/@prisma
ln -sfn /app/packages/db/node_modules/@node-rs /app/scripts/node_modules/@node-rs
ln -sfn /app/packages/db/node_modules/.prisma /app/scripts/node_modules/.prisma
node /app/scripts/setup-admin.mjs --email admin@capakraken.dev --name Admin --password admin123
'
- name: Set up Node.js 20
uses: actions/setup-node@v4.0.4