File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,24 @@ Set-Location (Join-Path $ScriptRoot "../autorest.powershell")
5151rush install
5252rush build
5353
54+ # Diagnostic: show autorest cache state and npm registry config before generation.
55+ Write-Host " --- Autorest/npm diagnostics ---"
56+ $autorestHome = if ($env: AUTOREST_HOME ) { $env: AUTOREST_HOME } else { Join-Path $env: USERPROFILE " .autorest" }
57+ Write-Host " AUTOREST_HOME: $autorestHome "
58+ $coreCacheDir = Join-Path $autorestHome " @autorest\core"
59+ if (Test-Path $coreCacheDir ) {
60+ Write-Host " Autorest core cache versions: $ ( Get-ChildItem $coreCacheDir - Directory | Select-Object - ExpandProperty Name) "
61+ $nodeModulesDir = Join-Path $coreCacheDir " 3.10.4\node_modules\@autorest\core"
62+ Write-Host " Cache 3.10.4 node_modules present: $ ( Test-Path $nodeModulesDir ) "
63+ } else {
64+ Write-Host " WARNING: Autorest core cache directory not found at $coreCacheDir "
65+ }
66+ Write-Host " npm registry: $ ( npm config get registry 2>&1 ) "
67+ Write-Host " NPM_CONFIG_USERCONFIG: $env: NPM_CONFIG_USERCONFIG "
68+ $userNpmrc = Join-Path $env: USERPROFILE " .npmrc"
69+ Write-Host " ~/.npmrc exists: $ ( Test-Path $userNpmrc ) "
70+ Write-Host " --- End diagnostics ---"
71+
5472$RequiredGraphModules = @ ()
5573$AuthModuleManifest = Join-Path $ModulesSrc " Authentication" " Authentication" " artifacts" " Microsoft.Graph.Authentication.psd1"
5674$LoadedAuthModule = Import-Module $AuthModuleManifest - PassThru - ErrorAction SilentlyContinue
Original file line number Diff line number Diff line change @@ -69,10 +69,15 @@ $ApiVersion | ForEach-Object {
6969 else {
7070 $FullModuleVersion = $ModuleMetadata.versions [$CurrentApiVersion ].version
7171 }
72- npx autorest -- max- memory- size= $MaxMemorySize -- module- version:$FullModuleVersion -- module- name:$ModuleFullName -- service- name:$Module -- input- file:$OpenApiFile $AutoRestModuleConfig -- max- cpu= 2 -- network- calls= 2
73- if ($LastExitCode -ne 0 ) {
74- Write-Host - ForegroundColor Red " AutoREST failed to generate '$ModuleFullName ' module."
75- return $LastExitCode
72+ $autorestLog = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath(), " autorest-$ ( $ModuleFullName -replace ' [^a-zA-Z0-9-]' , ' -' ) .log" )
73+ npx autorest -- verbose -- max- memory- size= $MaxMemorySize -- module- version:$FullModuleVersion -- module- name:$ModuleFullName -- service- name:$Module -- input- file:$OpenApiFile $AutoRestModuleConfig -- max- cpu= 2 -- network- calls= 2 2>&1 | Out-File - FilePath $autorestLog - Encoding utf8
74+ $autorestExitCode = $LASTEXITCODE
75+ if ($autorestExitCode -ne 0 ) {
76+ Write-Host - ForegroundColor Red " AutoREST failed (exit $autorestExitCode ) generating '$ModuleFullName '."
77+ Write-Host - ForegroundColor Yellow " === AutoREST log: $autorestLog ==="
78+ if (Test-Path $autorestLog ) { Get-Content $autorestLog | ForEach-Object { Write-Host $_ } }
79+ Write-Host - ForegroundColor Yellow " === End AutoREST log ==="
80+ return $autorestExitCode
7681 }
7782 Write-Debug " AutoRest generated '$ModuleFullName ' successfully."
7883
You can’t perform that action at this time.
0 commit comments