diff --git a/eng/common/scripts/TypeSpec-Project-Generate.ps1 b/eng/common/scripts/TypeSpec-Project-Generate.ps1 index d8845d60d..c16dad664 100644 --- a/eng/common/scripts/TypeSpec-Project-Generate.ps1 +++ b/eng/common/scripts/TypeSpec-Project-Generate.ps1 @@ -45,6 +45,14 @@ function NpmInstallForProject([string]$workingDirectory) { Write-Host("Copying package.json from $replacementPackageJson") Copy-Item -Path $replacementPackageJson -Destination "package.json" -Force + + $useAlphaNpmRegistry = (Get-Content $replacementPackageJson -Raw).Contains("-alpha.") + + if($useAlphaNpmRegistry) { + Write-Host "Package.json contains '-alpha.' in the version, Creating .npmrc using public/azure-sdk-for-js-test-autorest feed." + "registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest/npm/registry/ `n`nalways-auth=true" | Out-File '.npmrc' + } + npm install --no-lock-file if ($LASTEXITCODE) { exit $LASTEXITCODE } }