Skip to content

Commit b4d6a0b

Browse files
azure-sdkCopilotraych1weshaggard
authored
Sync eng/common directory with azure-sdk-tools for PR 12396 (#43281)
* Secure tsp-client usage by using pinned version from package-lock.json Co-authored-by: raych1 <[email protected]> * Use absolute path and remove try/finally blocks Co-authored-by: raych1 <[email protected]> * Keep original workingDirectory and use Push-Location for directory switching Co-authored-by: raych1 <[email protected]> * Resolve EmitterPackageJsonOutputPath to absolute path if relative Co-authored-by: raych1 <[email protected]> * Use workingDirectory instead of Push-Location/Pop-Location Co-authored-by: weshaggard <[email protected]> * Merge path resolution into tsp-client execution step Co-authored-by: raych1 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: raych1 <[email protected]> Co-authored-by: weshaggard <[email protected]>
1 parent 8ba0717 commit b4d6a0b

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

eng/common/pipelines/templates/archetype-typespec-emitter.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,27 +259,34 @@ extends:
259259
displayName: Download pipeline artifacts
260260

261261
- pwsh: |
262-
npm install -g @azure-tools/typespec-client-generator-cli@latest
262+
npm ci
263263
displayName: Install tsp-client
264+
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
264265
265266
- pwsh: |
267+
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
268+
$emitterPath = '${{ parameters.EmitterPackageJsonOutputPath }}'
269+
if (-not [System.IO.Path]::IsPathRooted($emitterPath)) {
270+
$emitterPath = Join-Path '$(Build.SourcesDirectory)' $emitterPath
271+
}
272+
266273
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
274+
Write-Host "Resolved emitter package path: $emitterPath"
267275
268276
if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
269277
Write-Host "Using overrides.json to generate emitter-package.json"
270-
tsp-client generate-config-files `
271-
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
272-
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}' `
273-
--overrides '$(buildArtifactsPath)/packages/overrides.json'
278+
npm exec --no -- tsp-client generate-config-files `
279+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
280+
--emitter-package-json-path "$emitterPath" `
281+
--overrides '$(buildArtifactsPath)/packages/overrides.json'
274282
} else {
275283
Write-Host "No overrides.json found. Running tsp-client without overrides."
276-
277-
tsp-client generate-config-files `
278-
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
279-
--emitter-package-json-path '${{ parameters.EmitterPackageJsonOutputPath }}'
284+
npm exec --no -- tsp-client generate-config-files `
285+
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
286+
--emitter-package-json-path "$emitterPath"
280287
}
281288
displayName: Generate emitter-package.json and emitter-package-lock files
282-
workingDirectory: $(Build.SourcesDirectory)
289+
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
283290
284291
- ${{ parameters.InitializationSteps }}
285292

0 commit comments

Comments
 (0)