Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'"
}

Expand All @@ -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
}
Expand All @@ -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
Expand Down
14 changes: 6 additions & 8 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"PSScriptAnalyzer":{
"MinimumVersion":"1.19.1",
"MaximumVersion":"1.99"
"PSScriptAnalyzer": {
"Version": "1.20.0"
},
"Plaster":{
"MinimumVersion":"1.0",
"MaximumVersion":"1.99"
"Plaster": {
"Version": "1.1.3"
},
"PSReadLine":{
"MinimumVersion":"2.0.2"
"PSReadLine": {
"Version": "2.1.0"
}
}