We keep a version of yarn in the repo, at `third_party/github.com/yarnpkg/`. All CI jobs should use that version for consistency (and easier updates). Previously, the Windows jobs did not use the local version. They used the version that came pre-installed on the docker image that we used. This made it more difficult to update the yarn version (something that we might want to do independently of updating other dependencies, such as Node.js). This commit fixes this by setting up the Windows CI jobs to also use the local, vendored version of yarn. PR Close #34384
15 lines
745 B
PowerShell
15 lines
745 B
PowerShell
# Use our local, vendored yarn in the global `yarn` command.
|
|
$globalYarnDir = "$HOME\AppData\Roaming\yarn"
|
|
$localYarnPath = & ${Env:ProgramFiles}\nodejs\node.exe ".\.circleci\get-vendored-yarn-path.js"
|
|
|
|
# Create a directory to put the yarn PowerShell script.
|
|
New-Item -Path "$globalYarnDir" -ItemType "directory" >$null
|
|
|
|
# Create the yarn PowerShell script (using the inferred path to the local yarn script).
|
|
Get-Content -Path ".\.circleci\windows-yarn.ps1.template" |
|
|
%{$_ -replace "{{ LOCAL_YARN_PATH_PLACEHOLDER }}", "$localYarnPath"} |
|
|
Add-Content -Path "$globalYarnDir\yarn.ps1"
|
|
|
|
# Add the directory containing the yarn PowerShell script to `PATH`.
|
|
Add-Content -Path $profile -Value ('$Env:path = "{0};" + $Env:path' -f $globalYarnDir)
|