Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions packages/http-client-python/eng/scripts/Build-Packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ New-Item -ItemType Directory -Force -Path "$outputPath/packages" | Out-Null
$emitterVersion = node -p -e "require('$packageRoot/package.json').version"
Write-Host "Package version: $emitterVersion"

# Stamp prerelease version if BuildNumber is provided
if ($BuildNumber) {
$versionTag = $Prerelease ? "-alpha" : "-beta"
$emitterVersion = "$emitterVersion$versionTag.$BuildNumber"
Write-Host "Stamped prerelease version: $emitterVersion"
}

Push-Location "$packageRoot"
try {
# Step 1: Build the emitter and generator
Expand All @@ -94,20 +87,12 @@ try {
Invoke-LoggedCommand "npm run lint" -GroupOutput
}

# Step 3: Stamp version in package.json if prerelease
if ($BuildNumber) {
Write-Host "`n=== Updating package.json version to $emitterVersion ===" -ForegroundColor Cyan
$packageJson = Get-Content -Raw "package.json" | ConvertFrom-Json -AsHashtable
$packageJson.version = $emitterVersion
$packageJson | ConvertTo-Json -Depth 100 | Out-File -Path "package.json" -Encoding utf8 -NoNewline -Force
}

# Step 4: Create npm package
# Step 3: Create npm package
Write-Host "`n=== Creating npm package ===" -ForegroundColor Cyan
Invoke-LoggedCommand "npm pack"
Copy-Item "typespec-http-client-python-$emitterVersion.tgz" -Destination "$outputPath/packages"

# Step 5: Verify package can be installed
# Step 4: Verify package can be installed
Write-Host "`n=== Verifying package installation ===" -ForegroundColor Cyan
Invoke-LoggedCommand "npm install typespec-http-client-python-$emitterVersion.tgz" -GroupOutput

Expand Down
Loading