From a0496b1d2c501fd9d3cacebc0809b5489f6d1b6c Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 25 Aug 2021 13:37:02 -0700 Subject: [PATCH 1/2] Update `modules.json` logic to use only `RequiredVersion` We want to know exactly which version of each module is being bundled with the extension, so the min/max logic was removed and replaced with just a precise version. The field `AllowPrerelease` is now based off the same parameter given per module because, again, we want to be explicit about our versions. --- PowerShellEditorServices.build.ps1 | 23 ++++++----------------- modules.json | 14 ++++++-------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 01e76ca61..5d4056feb 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -32,7 +32,6 @@ $script:IsNix = $IsLinux -or $IsMacOS $script:IsRosetta = $IsMacOS -and (sysctl -n sysctl.proc_translated) -eq 1 # Mac M1 $script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Hosting", "BuildInfo.cs") $script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditorServices.Common.props") -$script:IsPreview = [bool]($script:PsesCommonProps.Project.PropertyGroup.VersionSuffix) $script:NetRuntime = @{ PS7 = 'netcoreapp3.1' @@ -341,15 +340,13 @@ task RestorePsesModules -After Build { $name = $_.Name $body = @{ Name = $name - MinimumVersion = $_.Value.MinimumVersion - MaximumVersion = $_.Value.MaximumVersion - AllowPrerelease = $script:IsPreview + Version = $_.Value.Version + AllowPrerelease = $_.Value.AllowPrerelease Repository = if ($_.Value.Repository) { $_.Value.Repository } else { $DefaultModuleRepository } Path = $submodulePath } - if (-not $name) - { + if (-not $name) { throw "EditorServices module listed without name in '$ModulesJsonPath'" } @@ -364,10 +361,8 @@ task RestorePsesModules -After Build { } # Save each module in the modules.json file - foreach ($moduleName in $moduleInfos.Keys) - { - if (Test-Path -Path (Join-Path -Path $submodulePath -ChildPath $moduleName)) - { + foreach ($moduleName in $moduleInfos.Keys) { + if (Test-Path -Path (Join-Path -Path $submodulePath -ChildPath $moduleName)) { Write-Host "`tModule '${moduleName}' already detected. Skipping" continue } @@ -376,18 +371,12 @@ task RestorePsesModules -After Build { $splatParameters = @{ Name = $moduleName + RequiredVersion = $moduleInstallDetails.Version AllowPrerelease = $moduleInstallDetails.AllowPrerelease Repository = if ($moduleInstallDetails.Repository) { $moduleInstallDetails.Repository } else { $DefaultModuleRepository } Path = $submodulePath } - # Only add Min and Max version if we're doing a stable release. - # This is due to a PSGet issue with AllowPrerelease not installing the latest preview. - if (!$moduleInstallDetails.AllowPrerelease) { - $splatParameters.MinimumVersion = $moduleInstallDetails.MinimumVersion - $splatParameters.MaximumVersion = $moduleInstallDetails.MaximumVersion - } - Write-Host "`tInstalling module: ${moduleName} with arguments $(ConvertTo-Json $splatParameters)" Save-Module @splatParameters diff --git a/modules.json b/modules.json index d85819e6c..0544f7605 100644 --- a/modules.json +++ b/modules.json @@ -1,13 +1,11 @@ { - "PSScriptAnalyzer":{ - "MinimumVersion":"1.19.1", - "MaximumVersion":"1.99" + "PSScriptAnalyzer": { + "Version": "1.19.1" }, - "Plaster":{ - "MinimumVersion":"1.0", - "MaximumVersion":"1.99" + "Plaster": { + "Version": "1.1.3" }, - "PSReadLine":{ - "MinimumVersion":"2.0.2" + "PSReadLine": { + "Version": "2.1.0" } } From 52d6f40b100eca0f01e4027e93a0cb67415f58ab Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 25 Aug 2021 13:42:36 -0700 Subject: [PATCH 2/2] Update PSScriptAnalzyer to `v1.20.0` --- modules.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.json b/modules.json index 0544f7605..5b1559a21 100644 --- a/modules.json +++ b/modules.json @@ -1,6 +1,6 @@ { "PSScriptAnalyzer": { - "Version": "1.19.1" + "Version": "1.20.0" }, "Plaster": { "Version": "1.1.3"