diff --git a/automatic/nodejs.install/README.md b/automatic/nodejs.install/README.md index 8863ae7c94f..ca3211d4246 100644 --- a/automatic/nodejs.install/README.md +++ b/automatic/nodejs.install/README.md @@ -8,6 +8,7 @@ This package runs the official Node JS installer, resulting in Node.exe and NPM ## Notes - While this package now provides both **Current** and **LTS** releases of Node.js, it is still recommended to use the [nodejs-lts][] package if only targeting the latest LTS release is required. +- Starting with version 23.x, installations for 32bit platforms are no longer supported. If this is required, an older version is required to be used. - **If the package is out of date please check [Version History](#versionhistory) for the latest submitted version. If you have a question, please ask it in [Chocolatey Community Package Discussions](https://github.com/chocolatey-community/chocolatey-packages/discussions) or raise an issue on the [Chocolatey Community Packages Repository](https://github.com/chocolatey-community/chocolatey-packages/issues) if you have problems with the package. Disqus comments will generally not be responded to.** [nodejs-lts]: https://chocolatey.org/packages/nodejs-lts "Node.js LTS Package" diff --git a/automatic/nodejs.install/legal/VERIFICATION.full.txt b/automatic/nodejs.install/legal/VERIFICATION.full.txt new file mode 100644 index 00000000000..5fed5ed8dad --- /dev/null +++ b/automatic/nodejs.install/legal/VERIFICATION.full.txt @@ -0,0 +1,18 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's content are trustworthy. + +The installer/archive has been downloaded from the authors official download link listed on +and can be verified using the following: + +1. Download the following installers/archives + - 32-Bit: + - 64-Bit: +2. Use one of the following methods to obtain the checksum + - Use powershell function 'Get-FileHash' + - Use chocolatey utility 'checksum.exe' +3. Verify the downloaded installers/archives matches the following CHECKSUM_TYPE checksum: + - 32-Bit Checksum: <32BIT_CHECKSUM> + - 64-Bit Checksum: <64BIT_CHECKSUM> + +Additionally, the included 'LICENSE.txt' have been obtained from . diff --git a/automatic/nodejs.install/legal/VERIFICATION.x64.txt b/automatic/nodejs.install/legal/VERIFICATION.x64.txt new file mode 100644 index 00000000000..d5d3f2640c3 --- /dev/null +++ b/automatic/nodejs.install/legal/VERIFICATION.x64.txt @@ -0,0 +1,16 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's content are trustworthy. + +The installer/archive has been downloaded from the authors official download link listed on +and can be verified using the following: + +1. Download the following installers/archives + - 64-Bit: +2. Use one of the following methods to obtain the checksum + - Use powershell function 'Get-FileHash' + - Use chocolatey utility 'checksum.exe' +3. Verify the downloaded installers/archives matches the following CHECKSUM_TYPE checksum: + - 64-Bit Checksum: <64BIT_CHECKSUM> + +Additionally, the included 'LICENSE.txt' have been obtained from . diff --git a/automatic/nodejs.install/tools/chocolateyInstall.ps1 b/automatic/nodejs.install/tools/chocolateyInstall.ps1 index 667f19c506f..2eaed6b9bb3 100644 --- a/automatic/nodejs.install/tools/chocolateyInstall.ps1 +++ b/automatic/nodejs.install/tools/chocolateyInstall.ps1 @@ -1,21 +1,16 @@ -$ErrorActionPreference = 'Stop' +$ErrorActionPreference = 'Stop' $toolsPath = Split-Path $MyInvocation.MyCommand.Definition -$filePath32 = "$toolsPath\node-v20.18.0-x86.msi" -$filePath64 = "$toolsPath\node-v20.18.0-x64.msi" -$installFile = if ((Get-OSArchitectureWidth 64) -and $env:chocolateyForceX86 -ne 'true') { - Write-Host "Installing 64 bit version"; $filePath64 } - else { Write-Host "Installing 32 bit version"; $filePath32 } - $packageArgs = @{ PackageName = 'nodejs.install' FileType = 'msi' SoftwareName = 'Node.js' - File = $installFile + File = "$toolsPath\" + File64 = "$toolsPath\" SilentArgs = '/quiet ADDLOCAL=ALL' ValidExitCodes = @(0) } Install-ChocolateyInstallPackage @packageArgs -Remove-Item -Force $filePath32, $filePath64 -ea 0 +Remove-Item -Force "$toolsPath\*.exe","$toolsPath\*.msi" -ea 0 diff --git a/automatic/nodejs.install/update.ps1 b/automatic/nodejs.install/update.ps1 index a1ed58e7684..9e1f88a6398 100644 --- a/automatic/nodejs.install/update.ps1 +++ b/automatic/nodejs.install/update.ps1 @@ -5,7 +5,16 @@ Import-Module Chocolatey-AU if ($MyInvocation.InvocationName -ne '.') { # run the update only if the script is not sourced - function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge } + function global:au_BeforeUpdate { + Get-RemoteFiles -NoSuffix -Purge + + if ($Latest.URL32) { + Copy-Item "$PSScriptRoot\legal\VERIFICATION.full.txt" "$PSScriptRoot\legal\VERIFICATION.txt" -Force + } + else { + Copy-Item "$PSScriptRoot\legal\VERIFICATION.x64.txt" "$PSScriptRoot\legal\VERIFICATION.txt" -Force + } + } } function global:au_SearchReplace { @@ -15,20 +24,24 @@ function global:au_SearchReplace { } $silentArgs = "/quiet ADDLOCAL=ALL${silentArgs}" + $verificationReplacements = @{ + "(?i)(64-Bit:).*" = "`$1 <$($Latest.URL64)>" + "(?i)(the following).*(checksum:)" = "`${1} $($Latest.ChecksumType64.ToUpper()) `$2" + "(?i)(64-Bit Checksum:).*" = "`$1 <$($Latest.Checksum64)>" + } + + if ($Latest.URL32) { + $verificationReplacements['(?i)(32-Bit:).*'] = "`${1} <$($Latest.URL32)>" + $verificationReplacements['(?i)(32-Bit Checksum:).*'] = "`${1} <$($Latest.Checksum32)>" + } @{ ".\tools\chocolateyInstall.ps1" = @{ - "(^[$]filePath32\s*=\s*`"[$]toolsPath\\)(.*)`"" = "`$1$($Latest.FileName32)`"" - "(^[$]filePath64\s*=\s*`"[$]toolsPath\\)(.*)`"" = "`$1$($Latest.FileName64)`"" - "(?i)(^\s*SilentArgs\s*=\s*)'.*'" = "`${1}'$silentArgs'" - } - ".\legal\verification.txt" = @{ - "(?i)(32-Bit.+)\<.*\>" = "`${1}<$($Latest.URL32)>" - "(?i)(64-Bit.+)\<.*\>" = "`${1}<$($Latest.URL64)>" - "(?i)(checksum type:\s+).*" = "`${1}$($Latest.ChecksumType32)" - "(?i)(checksum32:\s+).*" = "`${1}$($Latest.Checksum32)" - "(?i)(checksum64:\s+).*" = "`${1}$($Latest.Checksum64)" + "(?i)(\s*file\s*=\s*)[`"']([$]toolsPath\\)?.*"= if ($Latest.FileName32) { "`${1}`"`$toolsPath\$($Latest.FileName32)`"" } else { "`${1}''" } + "(?i)(^\s*file64\s*=\s*`"[$]toolsPath\\).*" = "`${1}$($Latest.FileName64)`"" + "(?i)(^\s*SilentArgs\s*=\s*)'.*'" = "`${1}'$silentArgs'" } + ".\legal\verification.txt" = $verificationReplacements } } @@ -63,11 +76,16 @@ function global:au_GetLatest { $url32 = "https://nodejs.org/dist/$version/node-$version-x86.msi" $url64 = "https://nodejs.org/dist/$version/node-$version-x64.msi" - $streams.Add($versionStrict.Major.ToString(), @{ - Version = $versionStrict.ToString() - URL32 = $url32 - URL64 = $url64 - }) + $streamData = @{ + Version = $versionStrict.ToString() + URL64 = $url64 + } + + if ($versionStrict.Major -lt 23) { + $streamData['URL32'] = $url32 + } + + $streams.Add($versionStrict.Major.ToString(), $streamData) } return @{ Streams = $streams } diff --git a/automatic/nodejs/README.md b/automatic/nodejs/README.md index 6a87f4005f5..5cdfaa6c9bf 100644 --- a/automatic/nodejs/README.md +++ b/automatic/nodejs/README.md @@ -8,6 +8,7 @@ This package runs the official Node JS installer, resulting in Node.exe and NPM ## Notes - While this package now provides both **Current** and **LTS** releases of Node.js, it is still recommended to use the [nodejs-lts][] package if only targeting the latest LTS release is required. -- - **If the package is out of date please check [Version History](#versionhistory) for the latest submitted version. If you have a question, please ask it in [Chocolatey Community Package Discussions](https://github.com/chocolatey-community/chocolatey-packages/discussions) or raise an issue on the [Chocolatey Community Packages Repository](https://github.com/chocolatey-community/chocolatey-packages/issues) if you have problems with the package. Disqus comments will generally not be responded to.** +- Starting with version 23.x, installations for 32bit platforms are no longer supported. If this is required, an older version is required to be used. +- **If the package is out of date please check [Version History](#versionhistory) for the latest submitted version. If you have a question, please ask it in [Chocolatey Community Package Discussions](https://github.com/chocolatey-community/chocolatey-packages/discussions) or raise an issue on the [Chocolatey Community Packages Repository](https://github.com/chocolatey-community/chocolatey-packages/issues) if you have problems with the package. Disqus comments will generally not be responded to.** [nodejs-lts]: https://chocolatey.org/packages/nodejs-lts "Node.js LTS Package"