Skip to content

Commit 3d07d9f

Browse files
Copilotweshaggard
authored andcommitted
Use workingDirectory instead of Push-Location/Pop-Location
Co-authored-by: weshaggard <[email protected]>
1 parent 04cc1e0 commit 3d07d9f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -264,33 +264,33 @@ extends:
264264
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
265265
266266
- pwsh: |
267-
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
268-
269267
# Resolve EmitterPackageJsonOutputPath to absolute path if it's relative
270268
$emitterPath = '${{ parameters.EmitterPackageJsonOutputPath }}'
271269
if (-not [System.IO.Path]::IsPathRooted($emitterPath)) {
272270
$emitterPath = Join-Path '$(Build.SourcesDirectory)' $emitterPath
273271
}
274-
Write-Host "Resolved emitter package path: $emitterPath"
272+
Write-Host "##vso[task.setvariable variable=ResolvedEmitterPath]$emitterPath"
273+
displayName: Resolve emitter package path
274+
workingDirectory: $(Build.SourcesDirectory)
275+
276+
- pwsh: |
277+
Write-Host "Overrides location: $(buildArtifactsPath)/packages/overrides.json"
278+
Write-Host "Resolved emitter package path: $(ResolvedEmitterPath)"
275279
276280
if (Test-Path -Path '$(buildArtifactsPath)/packages/overrides.json') {
277281
Write-Host "Using overrides.json to generate emitter-package.json"
278-
Push-Location $(Build.SourcesDirectory)/eng/common/tsp-client
279282
npm exec --no -- tsp-client generate-config-files `
280283
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
281-
--emitter-package-json-path "$emitterPath" `
284+
--emitter-package-json-path '$(ResolvedEmitterPath)' `
282285
--overrides '$(buildArtifactsPath)/packages/overrides.json'
283-
Pop-Location
284286
} else {
285287
Write-Host "No overrides.json found. Running tsp-client without overrides."
286-
Push-Location $(Build.SourcesDirectory)/eng/common/tsp-client
287288
npm exec --no -- tsp-client generate-config-files `
288289
--package-json '$(buildArtifactsPath)/lock-files/package.json' `
289-
--emitter-package-json-path "$emitterPath"
290-
Pop-Location
290+
--emitter-package-json-path '$(ResolvedEmitterPath)'
291291
}
292292
displayName: Generate emitter-package.json and emitter-package-lock files
293-
workingDirectory: $(Build.SourcesDirectory)
293+
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
294294
295295
- ${{ parameters.InitializationSteps }}
296296

0 commit comments

Comments
 (0)