trying to fix build

This commit is contained in:
Bojan Kucera 2025-06-09 20:00:08 -04:00
parent cc19f88ad2
commit 47109baff7
41 changed files with 315 additions and 415 deletions

64
scripts/build-clean.ps1 Normal file
View file

@ -0,0 +1,64 @@
param(
[switch]$force
)
Write-Host "=== Clean Build Process ===" -ForegroundColor Green
# Step 1: Clean everything
Write-Host "Step 1: Cleaning build artifacts..." -ForegroundColor Yellow
& ".\scripts\clean.ps1" -dist -force
# Step 2: Install dependencies
Write-Host "Step 2: Installing dependencies..." -ForegroundColor Yellow
bun install
# Step 3: Build libraries in dependency order
Write-Host "Step 3: Building libraries..." -ForegroundColor Yellow
$libraries = @(
"types",
"config",
"logger",
"utils",
"postgres-client",
"mongodb-client",
"questdb-client",
"cache",
"http",
"event-bus",
"shutdown",
"data-frame",
"vector-engine",
"strategy-engine",
"data-adjustments"
)
foreach ($lib in $libraries) {
$libPath = "libs\$lib"
if (Test-Path $libPath) {
Write-Host "Building $lib..." -ForegroundColor Blue
Set-Location $libPath
bun run build
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build $lib" -ForegroundColor Red
Set-Location "..\..\"
exit 1
}
Set-Location "..\..\"
Write-Host "$lib built successfully" -ForegroundColor Green
} else {
Write-Host "⚠ Library $lib not found, skipping..." -ForegroundColor Yellow
}
}
# Step 4: Build applications
Write-Host "Step 4: Building applications..." -ForegroundColor Yellow
turbo run build --filter='./apps/*'
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build applications" -ForegroundColor Red
exit 1
}
Write-Host "=== Clean Build Complete! ===" -ForegroundColor Green
Write-Host "All packages built successfully" -ForegroundColor Blue

View file

@ -8,10 +8,9 @@ $libs = @(
"config", # Configuration - depends on types
"logger", # Logging utilities - depends on types
"utils", # Utilities - depends on types and config
# Database clients
# Database clients
"postgres-client", # PostgreSQL client - depends on types, config, logger
"mongodb-client", # MongoDB client - depends on types, config, logger
# "mongodb-client", # MongoDB client - depends on types, config, logger (temporarily disabled - needs zod->yup conversion)
"questdb-client", # QuestDB client - depends on types, config, logger
# Service libraries

94
scripts/verify-build.ps1 Normal file
View file

@ -0,0 +1,94 @@
param(
[switch]$verbose
)
Write-Host "=== Verifying Build Health ===" -ForegroundColor Green
$errors = @()
$warnings = @()
# Check for common build issues
Write-Host "Checking for common build issues..." -ForegroundColor Yellow
# Check for mismatched .d.ts files in source directories
Write-Host "Checking for .d.ts files in source directories..." -ForegroundColor Blue
$sourceDtsFiles = Get-ChildItem -Path ".\libs\*\src\**\*.d.ts" -Recurse -ErrorAction SilentlyContinue
if ($sourceDtsFiles.Count -gt 0) {
$warnings += "Found .d.ts files in source directories:"
foreach ($file in $sourceDtsFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check for missing dist directories after build
Write-Host "Checking for missing dist directories..." -ForegroundColor Blue
$libraries = @("types", "config", "logger", "utils", "cache", "http")
foreach ($lib in $libraries) {
$distPath = "libs\$lib\dist"
if (-not (Test-Path $distPath)) {
$errors += "Missing dist directory for $lib"
} else {
$indexFile = "$distPath\index.js"
if (-not (Test-Path $indexFile)) {
$errors += "Missing index.js in $lib dist directory"
}
}
}
# Check for stale tsbuildinfo files
Write-Host "Checking for stale tsbuildinfo files..." -ForegroundColor Blue
$tsbuildFiles = Get-ChildItem -Path ".\**\*.tsbuildinfo" -Recurse -ErrorAction SilentlyContinue
if ($tsbuildFiles.Count -gt 0) {
$warnings += "Found stale .tsbuildinfo files:"
foreach ($file in $tsbuildFiles) {
$warnings += " - $($file.FullName)"
}
}
# Check package.json dependencies
Write-Host "Checking package.json files..." -ForegroundColor Blue
$packageFiles = Get-ChildItem -Path ".\**\package.json" -Recurse -ErrorAction SilentlyContinue
foreach ($packageFile in $packageFiles) {
try {
$packageContent = Get-Content $packageFile.FullName | ConvertFrom-Json
if (-not $packageContent.name) {
$errors += "Package.json missing name: $($packageFile.FullName)"
}
if (-not $packageContent.version) {
$warnings += "Package.json missing version: $($packageFile.FullName)"
}
} catch {
$errors += "Invalid package.json: $($packageFile.FullName)"
}
}
# Report results
Write-Host "`n=== Build Health Report ===" -ForegroundColor Green
if ($errors.Count -gt 0) {
Write-Host "❌ ERRORS FOUND:" -ForegroundColor Red
foreach ($error in $errors) {
Write-Host " $error" -ForegroundColor Red
}
}
if ($warnings.Count -gt 0) {
Write-Host "⚠ WARNINGS:" -ForegroundColor Yellow
foreach ($warning in $warnings) {
Write-Host " $warning" -ForegroundColor Yellow
}
}
if ($errors.Count -eq 0 -and $warnings.Count -eq 0) {
Write-Host "✅ No issues found - build environment is healthy!" -ForegroundColor Green
} elseif ($errors.Count -eq 0) {
Write-Host "✅ No critical errors found (only warnings)" -ForegroundColor Green
} else {
Write-Host "❌ Critical errors found - build may fail" -ForegroundColor Red
exit 1
}
Write-Host "`nRecommended commands:" -ForegroundColor Cyan
Write-Host " Clean build: bun run reset" -ForegroundColor Gray
Write-Host " Quick build: bun run build" -ForegroundColor Gray
Write-Host " Clean only: bun run clean:dist" -ForegroundColor Gray