Sync eng/common directory with azure-sdk-tools for PR 12396 (#6770)
* Secure tsp-client usage by using pinned version from package-lock.json Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> * Use absolute path and remove try/finally blocks Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> * Keep original workingDirectory and use Push-Location for directory switching Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> * Resolve EmitterPackageJsonOutputPath to absolute path if relative Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> * Use workingDirectory instead of Push-Location/Pop-Location Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com> * Merge path resolution into tsp-client execution step Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: raych1 <20296335+raych1@users.noreply.github.com> Co-authored-by: weshaggard <9010698+weshaggard@users.noreply.github.com>
This commit is contained in:
parent
345101e9a5
commit
e19518ea0a
@ -259,27 +259,34 @@ extends:
|
||||
displayName: Download pipeline artifacts
|
||||
|
||||
- pwsh: |
|
||||
npm install -g @azure-tools/typespec-client-generator-cli@latest
|
||||
npm ci
|
||||
displayName: Install tsp-client
|
||||
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
|
||||
|
||||
- pwsh: |
|
||||
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
|
||||
$emitterPath = '${{ parameters.EmitterPackageJsonOutputPath }}'
|
||||
if (-not [System.IO.Path]::IsPathRooted($emitterPath)) {
|
||||
$emitterPath = Join-Path '$(Build.SourcesDirectory)' $emitterPath
|
||||
}
|
||||
|
||||
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
|
||||
Write-Host "Resolved emitter package path: $emitterPath"
|
||||
|
||||
if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
|
||||
Write-Host "Using overrides.json to generate emitter-package.json"
|
||||
tsp-client generate-config-files `
|
||||
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
|
||||
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
|
||||
--overrides '$(buildArtifactsPath)/packages/overrides.json'
|
||||
npm exec --no -- tsp-client generate-config-files `
|
||||
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
|
||||
--emitter-package-json-path "$emitterPath" `
|
||||
--overrides '$(buildArtifactsPath)/packages/overrides.json'
|
||||
} else {
|
||||
Write-Host "No overrides.json found. Running tsp-client without overrides."
|
||||
|
||||
tsp-client generate-config-files `
|
||||
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
|
||||
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
|
||||
npm exec --no -- tsp-client generate-config-files `
|
||||
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
|
||||
--emitter-package-json-path "$emitterPath"
|
||||
}
|
||||
displayName: Generate emitter-package.json and emitter-package-lock files
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
|
||||
|
||||
- ${{ parameters.InitializationSteps }}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user