adding data-services
This commit is contained in:
parent
e3bfd05b90
commit
405b818c86
139 changed files with 55943 additions and 416 deletions
28
scripts/build-libs.ps1
Normal file
28
scripts/build-libs.ps1
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Build and install the new libraries
|
||||
|
||||
Write-Host "Building and installing new libraries..." -ForegroundColor Cyan
|
||||
|
||||
# Build order is important due to dependencies
|
||||
$libs = @(
|
||||
"shared-types",
|
||||
"utils",
|
||||
"event-bus",
|
||||
"api-client"
|
||||
)
|
||||
|
||||
# Build each library in order
|
||||
foreach ($lib in $libs) {
|
||||
$libPath = "g:\repos\stock-bot\libs\$lib"
|
||||
|
||||
Write-Host "Building $lib..." -ForegroundColor Green
|
||||
Set-Location $libPath
|
||||
bun run build
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "Failed to build $lib. Exiting." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "All libraries built successfully!" -ForegroundColor Green
|
||||
Set-Location g:\repos\stock-bot
|
||||
86
scripts/create-package-aliases.ps1
Normal file
86
scripts/create-package-aliases.ps1
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/env pwsh
|
||||
|
||||
# Migration script for moving from packages/ to libs/
|
||||
# This script helps maintain backward compatibility during the transition
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$PackagesDir = "g:\repos\stock-bot\packages"
|
||||
$LibsDir = "g:\repos\stock-bot\libs"
|
||||
|
||||
function Write-ColorOutput($ForegroundColor) {
|
||||
$fc = $host.UI.RawUI.ForegroundColor
|
||||
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
||||
if ($args) {
|
||||
Write-Output $args
|
||||
}
|
||||
$host.UI.RawUI.ForegroundColor = $fc
|
||||
}
|
||||
|
||||
function Create-PackageAlias {
|
||||
param (
|
||||
[string]$PackageName
|
||||
)
|
||||
|
||||
$PackageDir = Join-Path $PackagesDir $PackageName
|
||||
$LibDir = Join-Path $LibsDir $PackageName
|
||||
|
||||
# Check if the lib already exists
|
||||
if (-not (Test-Path $LibDir)) {
|
||||
Write-ColorOutput "Red" "Error: Library $PackageName not found in $LibsDir"
|
||||
return
|
||||
}
|
||||
|
||||
# Create the package directory if it doesn't exist
|
||||
if (-not (Test-Path $PackageDir)) {
|
||||
New-Item -ItemType Directory -Force -Path $PackageDir | Out-Null
|
||||
Write-ColorOutput "Green" "Created directory: $PackageDir"
|
||||
}
|
||||
|
||||
# Create a package.json that points to the lib
|
||||
$PackageJsonPath = Join-Path $PackageDir "package.json"
|
||||
$PackageJson = @{
|
||||
name = "@stock-bot/$PackageName"
|
||||
version = "1.0.0"
|
||||
description = "Alias package that points to the new library location"
|
||||
main = "../../libs/$PackageName/dist/index.js"
|
||||
types = "../../libs/$PackageName/dist/index.d.ts"
|
||||
files = @("README.md")
|
||||
}
|
||||
|
||||
$JsonContent = $PackageJson | ConvertTo-Json -Depth 10
|
||||
Set-Content -Path $PackageJsonPath -Value $JsonContent
|
||||
Write-ColorOutput "Green" "Created alias package.json: $PackageJsonPath"
|
||||
|
||||
# Create a README explaining what this is
|
||||
$ReadmePath = Join-Path $PackageDir "README.md"
|
||||
$ReadmeContent = @"
|
||||
# $PackageName (Deprecated Path)
|
||||
|
||||
This package is now maintained in the \`libs/$PackageName\` directory.
|
||||
|
||||
This is a compatibility alias that points to the new location.
|
||||
|
||||
## Migration
|
||||
|
||||
Please update your imports to use the new path:
|
||||
|
||||
\`\`\`diff
|
||||
- import { ... } from '@stock-bot/$PackageName'
|
||||
+ import { ... } from '@stock-bot/$PackageName'
|
||||
\`\`\`
|
||||
|
||||
You don't need to change your imports yet, but this path will be removed in a future version.
|
||||
"@
|
||||
|
||||
Set-Content -Path $ReadmePath -Value $ReadmeContent
|
||||
Write-ColorOutput "Green" "Created README: $ReadmePath"
|
||||
}
|
||||
|
||||
# Create aliases for each library
|
||||
Write-ColorOutput "Yellow" "Creating package aliases for backward compatibility..."
|
||||
Create-PackageAlias "shared-types"
|
||||
|
||||
# Create additional aliases as needed for other libraries
|
||||
|
||||
Write-ColorOutput "Blue" "✓ Aliases created successfully. Importing from either packages/ or libs/ will work."
|
||||
Write-ColorOutput "Blue" " Please prefer importing from libs/ in new code."
|
||||
Loading…
Add table
Add a link
Reference in a new issue