updating build

This commit is contained in:
Bojan Kucera 2025-06-07 14:46:39 -04:00
parent a8ee4022bf
commit 8be4bfe6f2
8 changed files with 122 additions and 34 deletions

View file

@ -4,7 +4,6 @@
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"declaration": true, "declaration": true,
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true "esModuleInterop": true
}, },

View file

@ -4,12 +4,16 @@
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"declaration": true, "declaration": true,
"moduleResolution": "node", "declarationMap": true,
"module": "CommonJS", "sourceMap": false
"target": "ES2020"
}, },
"include": [ "include": [
"src/**/*" "src/**/*"
], ],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"] "exclude": [
"dist",
"node_modules",
"**/*.test.ts",
"**/*.spec.ts"
]
} }

View file

@ -3,13 +3,17 @@
"compilerOptions": { "compilerOptions": {
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"declaration": true "declaration": true,
"declarationMap": true,
"sourceMap": false
}, },
"include": [ "include": [
"src/**/*" "src/**/*"
], ],
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"], "exclude": [
"references": [ "dist",
{ "path": "../config" } "node_modules",
"**/*.test.ts",
"**/*.spec.ts"
] ]
} }

View file

@ -3,6 +3,7 @@
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"description": "Advanced trading bot with microservice architecture", "description": "Advanced trading bot with microservice architecture",
"type": "module",
"scripts": { "scripts": {
"dev": "turbo run dev", "dev": "turbo run dev",
"build": "turbo run build", "build": "turbo run build",
@ -16,9 +17,12 @@
"test:libs": "turbo run test --filter='./libs/*'", "test:libs": "turbo run test --filter='./libs/*'",
"test:apps": "turbo run test --filter=./apps/*/*", "test:apps": "turbo run test --filter=./apps/*/*",
"lint": "turbo run lint", "lint": "turbo run lint",
"clean": "turbo run clean",
"start": "turbo run start", "start": "turbo run start",
"clean:dist": "rimraf **/dist", "clean": "turbo run clean",
"clean:dist": "powershell ./scripts/clean.ps1 -dist",
"clean:modules": "powershell ./scripts/clean.ps1 -modules",
"clean:all": "powershell ./scripts/clean.ps1 -all",
"clean:fresh": "powershell ./scripts/clean.ps1 -fresh",
"backtest": "turbo run backtest", "backtest": "turbo run backtest",
"docker:start": "powershell ./scripts/docker.ps1 start", "docker:start": "powershell ./scripts/docker.ps1 start",
"docker:stop": "powershell ./scripts/docker.ps1 stop", "docker:stop": "powershell ./scripts/docker.ps1 stop",

View file

@ -5,13 +5,25 @@ Write-Host "Building and installing new libraries..." -ForegroundColor Cyan
# Build order is important due to dependencies # Build order is important due to dependencies
$libs = @( $libs = @(
"types", # Base types - no dependencies "types", # Base types - no dependencies
"logger", # Logging utilities - depends on types
"config", # Configuration - depends on types "config", # Configuration - depends on types
"utils", # Utilities - depends on types and config "cache", # Cache - depends on types and logger "logger", # Logging utilities - depends on types
"http", # HTTP client - depends on types, config, logger "utils", # Utilities - depends on types and config
# Database clients
"postgres-client", # PostgreSQL client - depends on types, config, logger "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
"questdb-client" # QuestDB client - depends on types, config, logger "questdb-client", # QuestDB client - depends on types, config, logger
# Service libraries
"cache", # Cache - depends on types and logger
"http", # HTTP client - depends on types, config, logger
"event-bus", # Event bus - depends on types, logger
"shutdown", # Shutdown - depends on types, logger
# Engine libraries
"data-frame", # Data frame - depends on types, utils
"vector-engine", # Vector engine - depends on types, utils, data-frame
"strategy-engine" # Strategy engine - depends on types, utils, event-bus
) )
# Build each library in order # Build each library in order

59
scripts/clean.ps1 Normal file
View file

@ -0,0 +1,59 @@
param(
[switch]$modules,
[switch]$dist,
[switch]$all,
[switch]$fresh
)
function Remove-DirectoriesByName {
param([string]$Name, [string]$Description)
Write-Host "Removing $Description..." -ForegroundColor Blue
$directories = Get-ChildItem -Path . -Name $Name -Recurse -Directory -ErrorAction SilentlyContinue
if ($directories.Count -gt 0) {
Write-Host "Found $($directories.Count) $Description to remove" -ForegroundColor Gray
$directories | ForEach-Object {
Remove-Item $_ -Recurse -Force -ErrorAction SilentlyContinue
Write-Host " Removed: $_" -ForegroundColor Gray
}
} else {
Write-Host "No $Description found" -ForegroundColor Gray
}
}
Write-Host "Starting cleanup..." -ForegroundColor Yellow
if ($all -or $fresh) {
Remove-DirectoriesByName "node_modules" "node_modules directories"
Remove-DirectoriesByName "dist" "dist directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
# Remove turbo clean since PowerShell already cleaned everything
Write-Host "Cleanup complete - no need for turbo clean" -ForegroundColor Blue
}
elseif ($modules) {
Remove-DirectoriesByName "node_modules" "node_modules directories"
Write-Host "Removing lock files..." -ForegroundColor Blue
Remove-Item -Path "bun.lockb" -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path . -Name "bun.lockb" -Recurse -File | Remove-Item -Force -ErrorAction SilentlyContinue
}
elseif ($dist) {
Remove-DirectoriesByName "dist" "dist directories"
}
else {
Write-Host "Running turbo clean..." -ForegroundColor Blue
# Only run turbo clean for the default case
turbo run clean
}
if ($fresh) {
Write-Host "Installing dependencies..." -ForegroundColor Green
bun install
}
Write-Host "Cleanup complete!" -ForegroundColor Green

View file

@ -3,8 +3,6 @@
"compilerOptions": { "compilerOptions": {
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src", "rootDir": "./src",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"] "types": ["bun-types"]
}, },
"include": ["src/**/*"], "include": ["src/**/*"],

View file

@ -3,9 +3,9 @@
"compilerOptions": { "compilerOptions": {
// JavaScript output target version // JavaScript output target version
"target": "ES2022", "target": "ES2022",
// Module configuration for different project types // Module configuration for different project types
"module": "ESNext", "module": "ESNext",
"moduleResolution": "node", "moduleResolution": "bundler",
"composite": true, "composite": true,
// Type checking // Type checking
@ -14,6 +14,7 @@
"strictNullChecks": true, "strictNullChecks": true,
"noImplicitThis": true, "noImplicitThis": true,
"alwaysStrict": true, "alwaysStrict": true,
"declarationMap": true,
// Module interoperability // Module interoperability
"esModuleInterop": true, "esModuleInterop": true,
@ -33,25 +34,32 @@
"paths": { "paths": {
"@stock-bot/*": ["libs/*/src"] "@stock-bot/*": ["libs/*/src"]
} }
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
"dist" "dist"
], "references": [ ],
{ "path": "./libs/config" }, "references": [
{ "path": "./libs/http" }, // Core libraries first
{ "path": "./libs/logger" },
{ "path": "./libs/mongodb-client" },
{ "path": "./libs/postgres-client" },
{ "path": "./libs/questdb-client" },
{ "path": "./libs/types" }, { "path": "./libs/types" },
{ "path": "./libs/cache" }, { "path": "./libs/config" },
{ "path": "./libs/logger" },
{ "path": "./libs/utils" }, { "path": "./libs/utils" },
{ "path": "./libs/event-bus" },
{ "path": "./libs/data-frame" },
{ "path": "./libs/strategy-engine" },
{ "path": "./libs/vector-engine" },
]
} // Database clients
{ "path": "./libs/postgres-client" },
{ "path": "./libs/mongodb-client" },
{ "path": "./libs/questdb-client" },
// Service libraries
{ "path": "./libs/cache" },
{ "path": "./libs/http" },
{ "path": "./libs/event-bus" },
{ "path": "./libs/shutdown" },
// Engine libraries
{ "path": "./libs/data-frame" },
{ "path": "./libs/vector-engine" },
{ "path": "./libs/strategy-engine" }
]
}