Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 6823 (Azure#26905)
Browse files Browse the repository at this point in the history
Sync eng/common directory with azure-sdk-tools for PR
Azure/azure-sdk-tools#6823 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

Co-authored-by: Patrick Hallisey <pahallis@microsoft.com>
  • Loading branch information
azure-sdk and hallipr authored Aug 23, 2023
1 parent 9faa6c6 commit 76435ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
26 changes: 24 additions & 2 deletions eng/common/scripts/TypeSpec-Project-Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,36 @@ function NpmInstallForProject([string]$workingDirectory) {
Write-Host("Copying package.json from $replacementPackageJson")
Copy-Item -Path $replacementPackageJson -Destination "package.json" -Force

#default to root/eng/emitter-package-lock.json but you can override by writing
#Get-${Language}-EmitterPackageLockPath in your Language-Settings.ps1
$emitterPackageLock = Join-Path $PSScriptRoot "../../emitter-package-lock.json"
if (Test-Path "Function:$GetEmitterPackageLockPathFn") {
$emitterPackageLock = &$GetEmitterPackageLockPathFn
}

$usingLockFile = Test-Path $emitterPackageLock

if ($usingLockFile) {
Write-Host("Copying package-lock.json from $emitterPackageLock")
Copy-Item -Path $emitterPackageLock -Destination "package-lock.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'
"registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/ `n`nalways-auth=true" | Out-File '.npmrc'
}

if ($usingLockFile) {
Write-Host "> npm ci"
npm ci
}
else {
Write-Host "> npm install"
npm install
}

npm install --no-lock-file
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
finally {
Expand Down
1 change: 1 addition & 0 deletions eng/common/scripts/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ $GetRepositoryLinkFn = "Get-${Language}-RepositoryLink"
$GetEmitterAdditionalOptionsFn = "Get-${Language}-EmitterAdditionalOptions"
$GetEmitterNameFn = "Get-${Language}-EmitterName"
$GetEmitterPackageJsonPathFn = "Get-${Language}-EmitterPackageJsonPath"
$GetEmitterPackageLockPathFn = "Get-${Language}-EmitterPackageLockPath"

# Expected to be set in eng/scripts/docs/Docs-Onboarding.ps1
$SetDocsPackageOnboarding = "Set-${Language}-DocsPackageOnboarding"
Expand Down

0 comments on commit 76435ab

Please sign in to comment.