File tree Expand file tree Collapse file tree
.azure-pipelines/common-templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,22 @@ steps:
7575 workingDir : $(Build.SourcesDirectory)
7676 customCommand : install -g @autorest/core@3.10.4 --registry https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/PowerShell_V2_Build/npm/registry/
7777
78+ - task : PowerShell@2
79+ displayName : Pre-populate autorest core cache
80+ inputs :
81+ targetType : inline
82+ pwsh : true
83+ script : |
84+ # Autorest looks for @autorest/core in ~/.autorest/@autorest/core/<version>/node_modules/
85+ # Pre-installing it here with the explicit registry flag means autorest never needs
86+ # to make any npm calls during module generation.
87+ $cacheDir = Join-Path $env:USERPROFILE ".autorest\@autorest\core\3.10.4"
88+ New-Item -ItemType Directory -Force -Path $cacheDir | Out-Null
89+ Write-Host "Pre-installing @autorest/core@3.10.4 into autorest cache: $cacheDir"
90+ npm install @autorest/core@3.10.4 --prefix $cacheDir --registry https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/PowerShell_V2_Build/npm/registry/
91+ if ($LASTEXITCODE -ne 0) { throw "Failed to pre-install @autorest/core@3.10.4 into autorest cache (exit $LASTEXITCODE)" }
92+ Write-Host "Autorest core cache pre-populated successfully"
93+
7894 - task : Npm@1
7995 displayName : Install Rush
8096 inputs :
You can’t perform that action at this time.
0 commit comments