@@ -56,13 +56,17 @@ if (-not $SkipDownload) {
5656 Write-Host " -> Cortex already downloaded"
5757 }
5858
59- # Mayros npm tarball
60- $mayrosTarball = Join-Path $DepsDir " apilium-mayros-${MayrosVersion} .tgz"
61- if (-not (Test-Path $mayrosTarball )) {
62- Write-Host " -> npm pack @apilium/mayros@${MayrosVersion} "
59+ # Mayros npm tarball — try published version first, fall back to local build
60+ $mayrosTarball = Get-ChildItem - Path $DepsDir - Filter " apilium-mayros-*.tgz" | Select-Object - First 1
61+ if (-not $mayrosTarball ) {
6362 Push-Location $DepsDir
64- npm pack " @apilium/mayros@${MayrosVersion} " -- quiet 2> $null
63+ $repoRoot = Split-Path - Parent $InstallerDir
64+ Write-Host " -> Packing Mayros from local build..."
65+ $ErrorActionPreference = " Continue"
66+ & npm pack $repoRoot 2>&1 | Out-Null
67+ $ErrorActionPreference = " Stop"
6568 Pop-Location
69+ $mayrosTarball = Get-ChildItem - Path $DepsDir - Filter " apilium-mayros-*.tgz" | Select-Object - First 1
6670 } else {
6771 Write-Host " -> Mayros tarball already downloaded"
6872 }
@@ -91,13 +95,36 @@ $binDir = Join-Path $StageDir "bin"
9195New-Item - ItemType Directory - Force - Path $binDir | Out-Null
9296Expand-Archive - Path (Join-Path $DepsDir $CortexFile ) - DestinationPath $binDir - Force
9397
94- # Extract Mayros CLI
95- Write-Host " -> Extracting Mayros CLI..."
98+ # Extract/Copy Mayros CLI
99+ Write-Host " -> Preparing Mayros CLI..."
96100$cliDir = Join-Path $StageDir " cli"
97101New-Item - ItemType Directory - Force - Path $cliDir | Out-Null
98102$tarball = Get-ChildItem - Path $DepsDir - Filter " *.tgz" | Select-Object - First 1
99103if ($tarball ) {
100104 tar - xzf $tarball.FullName - C $cliDir -- strip- components= 1
105+ } else {
106+ # No tarball — copy from local repo build
107+ $repoRoot = Split-Path - Parent $InstallerDir
108+ Write-Host " -> Copying from local build: $repoRoot "
109+ $distDir = Join-Path $repoRoot " dist"
110+ if (Test-Path $distDir ) {
111+ Copy-Item - Recurse " $distDir \*" $cliDir - Force
112+ # Copy package.json and other needed files
113+ Copy-Item (Join-Path $repoRoot " package.json" ) $cliDir - Force
114+ if (Test-Path (Join-Path $repoRoot " LICENSE" )) {
115+ Copy-Item (Join-Path $repoRoot " LICENSE" ) $cliDir - Force
116+ }
117+ # Copy node_modules using robocopy (handles long paths)
118+ $nmDir = Join-Path $repoRoot " node_modules"
119+ if (Test-Path $nmDir ) {
120+ Write-Host " -> Copying node_modules via robocopy (handles long paths)..."
121+ $nmDest = Join-Path $cliDir " node_modules"
122+ robocopy $nmDir $nmDest / E / NFL / NDL / NJH / NJS / NC / NS / NP | Out-Null
123+ }
124+ } else {
125+ Write-Host " ERROR: No dist/ directory found. Run 'pnpm build' first." - ForegroundColor Red
126+ exit 1
127+ }
101128}
102129
103130# Copy wrapper scripts
0 commit comments