Visual Studio Code updated

New Electron version is 17.4.1
This commit is contained in:
John 2022-05-05 16:45:48 -05:00
parent 63d0b5aee3
commit fecdf31c1f
2 changed files with 28 additions and 26 deletions

View File

@ -103,7 +103,8 @@ electronversion=""
case `code --version` in case `code --version` in
#* Each version of VSCode has a corresponding Electron version and Node version #* Each version of VSCode has a corresponding Electron version and Node version
#* These are used when configuring nvm #* These are used when configuring nvm
1.66.*) electronversion="17.2.0"; nodeversion="16.14.2";; 1.66.*) electronversion="17.2.0"; nodeversion="16.13.0";;
1.67.*) electronversion="17.4.1"; nodeversion="16.13.0";;
*) nodeversion="--lts";; *) nodeversion="--lts";;
esac esac

View File

@ -114,7 +114,8 @@ if ( ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S-1-5
Write-Host "Press any key to continue... " Write-Host "Press any key to continue... "
[void][Console]::ReadKey(1) # Equivalent to Command Prompt's `pause` command [void][Console]::ReadKey(1) # Equivalent to Command Prompt's `pause` command
} }
} else { }
else {
# Throw a fatal errorOccurred if the user tries to run as administrator. # Throw a fatal errorOccurred if the user tries to run as administrator.
Throw "Script must be run as a normal user." Throw "Script must be run as a normal user."
} }
@ -158,7 +159,8 @@ function EnsureNodePackageInstalled {
if ( -not (Get-CommandAvailable $command[0])) { if ( -not (Get-CommandAvailable $command[0])) {
Throw "$command failed to install. Aborting." Throw "$command failed to install. Aborting."
} }
} else { }
else {
Write-Host "`n$($command[0]) already installed." -ForegroundColor green Write-Host "`n$($command[0]) already installed." -ForegroundColor green
} }
} }
@ -182,16 +184,18 @@ Invoke-Dryrun "npm audit fix"
# if we're on a known VSCode version, go ahead and run electron-rebuild # if we're on a known VSCode version, go ahead and run electron-rebuild
switch -Regex (code --version) { switch -Regex (code --version) {
<# "1\.6[7-9]\.[0-9]+" {
#?: Do we update this in the future, or stop maintaining it and remove this entire switch block? #?: Do we update this in the future, or stop maintaining it and remove this entire switch block?
} #> "1\.67\.\d+" { $electronversion = "17.4.1"; break } # April 2022 update
"1\.66\.[0-9]+" { # 1.66 "1\.66\.\d+" { $electronversion = "17.2.0"; break } # March 2022 update
Write-Host "`nRebuilding Electron for your version of VSCode..." default { $electronversion = $false } # Unknown update
Invoke-Dryrun 'electron-rebuild --version="17.2.0"'
Write-Host "Done!" -ForegroundColor green
break
} }
"\d+\.\d+\.\d+" { # Anything else
if ( $electronversion ) {
Write-Host "`nRebuilding Electron for your version of VSCode..."
Invoke-Dryrun "electron-rebuild --version='$electronversion'"
Write-Host "Done!" -ForegroundColor green
}
else {
Write-Host "`nOpen Visual Studio Code, select the `"Help`" tab in the Toolbar, and go to `"About`".`nYou should see a page that looks like the following:" -ForegroundColor darkcyan Write-Host "`nOpen Visual Studio Code, select the `"Help`" tab in the Toolbar, and go to `"About`".`nYou should see a page that looks like the following:" -ForegroundColor darkcyan
Write-Host " `(i`) Visual Studio Code`n`n Version: 1.66.2 `(user setup`)`n Commit: [Commit ID]`n Date: 2022-04-11T07:46:01.075Z`n Electron: 17.2.0`n [ ... ]" -ForegroundColor White Write-Host " `(i`) Visual Studio Code`n`n Version: 1.66.2 `(user setup`)`n Commit: [Commit ID]`n Date: 2022-04-11T07:46:01.075Z`n Electron: 17.2.0`n [ ... ]" -ForegroundColor White
@ -201,9 +205,6 @@ switch -Regex (code --version) {
Write-Host "Run the command " -NoNewLine Write-Host "Run the command " -NoNewLine
Write-Host "electron-rebuild --version ELECTRON_VERSION" -NoNewLine -ForegroundColor green Write-Host "electron-rebuild --version ELECTRON_VERSION" -NoNewLine -ForegroundColor green
Write-Host " in Mind-Reader`'s root folder.`n" Write-Host " in Mind-Reader`'s root folder.`n"
break # Don't process the next items in the collection.
}
default { } # Leave blank
} }
# Return from whence we came # Return from whence we came