From 0866fa3e3bb26391eb27e4f432902bd6fe95393c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=85=E2=80=9A=20Miczek?= Date: Fri, 13 Feb 2026 20:40:25 +0100 Subject: [PATCH] fix: prepend node_modules/.bin to PATH for ng in CI Co-authored-by: Cursor --- package.json | 3 +-- scripts/build-with-env.js | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index cef6e56..595169a 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,7 @@ "watch": "ng build --watch --configuration development", "test": "jest", "serve:ssr": "node scripts/serve-ssr.js", - "server:build": "ng run goals-tracker:server:production", - "build:ssr": "bun run build:prod && bun run server:build", + "build:ssr": "bun run build:prod", "prerender": "ng run goals-tracker:prerender" }, "private": true, diff --git a/scripts/build-with-env.js b/scripts/build-with-env.js index ee09126..e08a5e5 100644 --- a/scripts/build-with-env.js +++ b/scripts/build-with-env.js @@ -4,5 +4,11 @@ * Use for production build so process.env is populated for environment.prod.ts. */ require('dotenv').config(); +const path = require('path'); const { execSync } = require('child_process'); -execSync('bun run build', { stdio: 'inherit', cwd: process.cwd(), shell: true }); +const binDir = path.join(process.cwd(), 'node_modules', '.bin'); +const pathSep = process.platform === 'win32' ? ';' : ':'; +const pathEnv = binDir + pathSep + (process.env.PATH || ''); +const env = { ...process.env, PATH: pathEnv }; +execSync('ng build', { stdio: 'inherit', env }); +execSync('ng run goals-tracker:server:production', { stdio: 'inherit', env });