From e6b11120ab7f5c4d0e301f1ac955f6a311822ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hartmut=20N=C3=B6renberg?= Date: Mon, 13 Apr 2026 00:25:36 +0200 Subject: [PATCH] ci(docker-deploy): symlink packages/db node_modules into scripts/ 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. --- .github/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f64ca84..9a97ce6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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