@@ -405,6 +405,8 @@ $idx = [Array]::IndexOf(@($availableEditors.Scheme), $targetScheme)
405405
406406if ($targetScheme -and $idx -ge 0 ) {
407407 $selectedIndex = $idx
408+ } elseif ($targetScheme -eq " all" ) {
409+ $installAll = $true
408410} else {
409411 Write-Host " "
410412 for ($i = 0 ; $i -lt $availableEditors.Count ; $i ++ ) {
@@ -493,86 +495,92 @@ if (!(Test-Path $cwcDir)) {
493495 New-Item - ItemType Directory - Path $cwcDir | Out-Null
494496}
495497
496- $indices = if ($installAll ) { 0 .. ($availableEditors.Count - 1 ) } else { $selectedIndex }
497- foreach ($i in $indices ) {
498- $editor = $availableEditors [$i ]
498+ if ($installAll ) {
499+ $repoDir = Join-Path $cwcDir " repository"
500+ } else {
501+ $editor = $availableEditors [$selectedIndex ]
499502 $repoDir = Join-Path $cwcDir " repository-$ ( $editor.Scheme ) "
503+ }
500504
501- if ($installAll ) {
502- Write-Host " `n === $ ( $editor.Name ) ===" - ForegroundColor Cyan
503- }
504-
505- $updated = $false
506- if (Test-Path (Join-Path $repoDir " .git" )) {
507- $updated = Invoke-Step " $msg_step_cloning ..." {
508- git - C $repoDir fetch origin -- tags -- quiet * > $null
509- if ($LASTEXITCODE -ne 0 ) { throw " Failed to fetch" }
510- if ($tagName ) {
511- git - C $repoDir checkout $tagName -- quiet * > $null
512- if ($LASTEXITCODE -ne 0 ) { throw " Failed to checkout" }
505+ $updated = $false
506+ if (Test-Path (Join-Path $repoDir " .git" )) {
507+ $updated = Invoke-Step " $msg_step_cloning ..." {
508+ git - C $repoDir fetch origin -- tags -- quiet * > $null
509+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to fetch" }
510+ if ($tagName ) {
511+ git - C $repoDir checkout $tagName -- quiet * > $null
512+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to checkout" }
513+ } else {
514+ $latestTag = git - C $repoDir tag - l ' *-vscode' -- sort=- creatordate | Select-Object - First 1
515+ if ($latestTag ) {
516+ git - C $repoDir checkout $latestTag -- quiet * > $null
517+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to checkout latest tag" }
513518 } else {
514- $latestTag = git - C $repoDir tag - l ' *-vscode' -- sort=- creatordate | Select-Object - First 1
515- if ($latestTag ) {
516- git - C $repoDir checkout $latestTag -- quiet * > $null
517- if ($LASTEXITCODE -ne 0 ) { throw " Failed to checkout latest tag" }
518- } else {
519- git - C $repoDir reset -- hard origin/ main -- quiet * > $null
520- if ($LASTEXITCODE -ne 0 ) { throw " Failed to reset" }
521- }
519+ git - C $repoDir reset -- hard origin/ main -- quiet * > $null
520+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to reset" }
522521 }
523- git - C $repoDir clean - fd -- quiet * > $null
524- if ($LASTEXITCODE -ne 0 ) { throw " Failed to clean" }
525- } $msg_step_cloning
526- }
527-
528- if (-not $updated ) {
529- if (Test-Path $repoDir ) {
530- Remove-Item - Path $repoDir - Recurse - Force - ErrorAction SilentlyContinue
531522 }
532- $null = Invoke-Step " $msg_step_cloning ..." {
533- Clone- Repo
534- } $msg_step_cloning
523+ git - C $repoDir clean - fd -- quiet * > $null
524+ if ($LASTEXITCODE -ne 0 ) { throw " Failed to clean" }
525+ } $msg_step_cloning
526+ }
527+
528+ if (-not $updated ) {
529+ if (Test-Path $repoDir ) {
530+ Remove-Item - Path $repoDir - Recurse - Force - ErrorAction SilentlyContinue
535531 }
532+ $null = Invoke-Step " $msg_step_cloning ..." {
533+ Clone- Repo
534+ } $msg_step_cloning
535+ }
536536
537- Set-Location $repoDir
537+ Set-Location $repoDir
538538
539- $depsOk = Invoke-Step " $msg_step_deps ..." {
540- pnpm install * > $null
541- }
539+ $depsOk = Invoke-Step " $msg_step_deps ..." {
540+ pnpm install * > $null
541+ }
542542
543- if (-not $depsOk ) {
544- Write-Host " $msg_deps_retry " - ForegroundColor Yellow
545- Set-Location $cwcDir
546- Get-ChildItem - Path $cwcDir - Filter " repository* " - Directory | Remove-Item - Recurse - Force - ErrorAction SilentlyContinue
543+ if (-not $depsOk ) {
544+ Write-Host " $msg_deps_retry " - ForegroundColor Yellow
545+ Set-Location $cwcDir
546+ Remove-Item - Path $repoDir - Recurse - Force - ErrorAction SilentlyContinue
547547
548- $prevPreference = $ErrorActionPreference
549- $ErrorActionPreference = " Continue"
550- try { pnpm store prune * > $null } catch {}
551- $ErrorActionPreference = $prevPreference
548+ $prevPreference = $ErrorActionPreference
549+ $ErrorActionPreference = " Continue"
550+ try { pnpm store prune * > $null } catch {}
551+ $ErrorActionPreference = $prevPreference
552552
553- $null = Invoke-Step " $msg_step_cloning ..." {
554- Clone- Repo
555- } $msg_step_cloning
553+ $null = Invoke-Step " $msg_step_cloning ..." {
554+ Clone- Repo
555+ } $msg_step_cloning
556556
557- Set-Location $repoDir
557+ Set-Location $repoDir
558558
559- $null = Invoke-Step " $msg_step_deps ..." {
560- pnpm install * > $null
561- } $msg_step_deps
562- }
559+ $null = Invoke-Step " $msg_step_deps ..." {
560+ pnpm install * > $null
561+ } $msg_step_deps
562+ }
563563
564- Set-Location apps/ editor
564+ Set-Location apps/ editor
565565
566- Remove-Item * .vsix - Force - ErrorAction SilentlyContinue
566+ Remove-Item * .vsix - Force - ErrorAction SilentlyContinue
567567
568- $null = Invoke-Step " $msg_step_build ..." {
569- pnpm run build * > $null
570- } $msg_step_build
568+ $null = Invoke-Step " $msg_step_build ..." {
569+ pnpm run build * > $null
570+ } $msg_step_build
571571
572- $vsixFile = Get-ChildItem * .vsix - ErrorAction SilentlyContinue | Select-Object - First 1
572+ $vsixFile = Get-ChildItem * .vsix - ErrorAction SilentlyContinue | Select-Object - First 1
573573
574- if (! $vsixFile ) {
575- Fail $msg_vsix_error
574+ if (! $vsixFile ) {
575+ Fail $msg_vsix_error
576+ }
577+
578+ $indices = if ($installAll ) { 0 .. ($availableEditors.Count - 1 ) } else { $selectedIndex }
579+ foreach ($i in $indices ) {
580+ $editor = $availableEditors [$i ]
581+
582+ if ($installAll ) {
583+ Write-Host " `n === $ ( $editor.Name ) ===" - ForegroundColor Cyan
576584 }
577585
578586 $ok = Invoke-Step " $msg_step_install $ ( $editor.Name ) ..." {
@@ -587,8 +595,6 @@ foreach ($i in $indices) {
587595 } else {
588596 Write-Host " $msg_error $msg_install_fail $ ( $editor.Name ) ." - ForegroundColor Red
589597 }
590-
591- Set-Location $originalLocation
592598}
593599
594600} finally {
0 commit comments