Skip to content

Commit ea81836

Browse files
fix: add all MTG packages to generated nuget.config for OAI regenpreview (#9124)
The regen preview script is failing locally now do to the other MTG nuget packages not being found in the upstream feed when it should be looking at the local disk feed. Also addresses some issues with npm caching when regenerating OAI locally.
1 parent db33781 commit ea81836

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/http-client-csharp/eng/scripts/RegenPreview.psm1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,9 @@ function Update-OpenAIGenerator {
516516
-NuGetConfigPath $nugetConfigPath `
517517
-SourcePath $DebugFolder `
518518
-PackagePatterns @(
519-
"Microsoft.TypeSpec.Generator.ClientModel"
519+
"Microsoft.TypeSpec.Generator.ClientModel",
520+
"Microsoft.TypeSpec.Generator.Input"
521+
"Microsoft.TypeSpec.Generator"
520522
)
521523

522524
# Update codegen/package.json
@@ -553,20 +555,20 @@ function Update-OpenAIGenerator {
553555
$packageJson | ConvertTo-Json -Depth 100 | Set-Content $codegenPackageJsonPath -Encoding UTF8
554556

555557
# Delete package-lock.json to force regeneration with new dependencies
556-
$packageLockPath = Join-Path $OpenAIRepoPath "codegen" "package-lock.json"
558+
$packageLockPath = Join-Path $OpenAIRepoPath "package-lock.json"
557559
if (Test-Path $packageLockPath) {
558-
Write-Host "Deleting codegen/package-lock.json..." -ForegroundColor Gray
560+
Write-Host "Deleting package-lock.json..." -ForegroundColor Gray
559561
Remove-Item $packageLockPath -Force
560562
}
561563

562564
# Run npm install to regenerate package-lock.json with local dependencies
563-
Write-Host "Installing dependencies in codegen directory..." -ForegroundColor Gray
564-
Push-Location (Join-Path $OpenAIRepoPath "codegen")
565+
Write-Host "Installing dependencies in openai directory..." -ForegroundColor Gray
566+
Push-Location $OpenAIRepoPath
565567
try {
566-
$npmOutput = Invoke "npm install" (Join-Path $OpenAIRepoPath "codegen")
568+
$npmOutput = Invoke "npm install" $OpenAIRepoPath
567569
if ($LASTEXITCODE -ne 0) {
568570
Write-Host $npmOutput -ForegroundColor Red
569-
throw "npm install failed in codegen directory"
571+
throw "npm install failed"
570572
}
571573
Write-Host " Dependencies installed" -ForegroundColor Green
572574
}

0 commit comments

Comments
 (0)