Skip to content

Conversation

@JustinGrote
Copy link
Owner

This pull request adds initial support for prerelease modules and enables the prerelease feature automatically if specified. It also includes updates to the Get-ModuleFastPlan function to filter and show prerelease modules based on user preferences.

@JustinGrote JustinGrote self-assigned this Dec 13, 2023
@JustinGrote JustinGrote merged commit 3a43201 into main Dec 13, 2023
@JustinGrote JustinGrote deleted the feature/prerelease branch December 13, 2023 00:55
@johlju
Copy link
Contributor

johlju commented Dec 13, 2023

My heart jumped when I saw this PR. But looking at the code in this change it looks like it is still not possible to specify just one of several modules passed to Get-ModuleFastPlan to return the latest prerelease, or to specify that one of several modules should return specific prerelease version. Was hoping it would close issue #7. But great of you getting initial prerelease support working! It will help other use-cases.

@JustinGrote
Copy link
Owner Author

@johlju yes, currently if you specify a prerelease spec for one module it is assumed you want prerelease for all modules. You can work around this by pinning your upper version e.g. 'Az<=3.2.0' and since prereleases sort below released versions, you will not see a prerelease e.g. 3.2.0-alpha1 in this case.

I'm thinking about incorporating a syntax like ! to flag individual items as prerelease without requiring the whole thing to operate on prerelease.

@johlju
Copy link
Contributor

johlju commented Dec 14, 2023

Yes using ! could work, but does it need to work on both the ModuleName and RequiredVersion in the module specification passed to Get-ModuleFastPlan?

E.g.:

  • ModuleName = 'Az!' - means latest prerelease or latest release, the last module version to been released
  • RequiredVersion = '1.0.1!' - means the latest prerelease version of 1.0.1 or full release 1.0.1. (It won't choose 1.0.2-alpha if it exist).
  • RequiredVersion = '1.0.1-beta2' - when version have a prerelease string means this specific prerelease. This could also be written as '1.0.1-beta2!'

@JustinGrote
Copy link
Owner Author

JustinGrote commented Dec 14, 2023

It would be on modulename most likely and I will probably use * instead of ! because * is not a valid filename character and thus not a valid module character.

Note there are many more ways to specify a modulespec now such as nuget syntax:

Context 'ModuleFastSpec String' {
$stringTestCases = (
@{
Spec = 'Az.Accounts'
Check = {
$actual.ModuleVersion | Should -BeGreaterThan '2.7.3'
}
},
@{
Spec = 'Az.Accounts@2.7.3'
Check = {
$actual.ModuleVersion | Should -Be '2.7.3'
}
},
@{
Spec = 'Az.Accounts>2.7.3'
Check = {
$actual.ModuleVersion | Should -BeGreaterThan '2.7.3'
}
},
@{
Spec = 'Az.Accounts<2.7.3'
Check = {
$actual.ModuleVersion | Should -BeLessThan '2.7.3'
}
},
@{
Spec = 'Az.Accounts<=2.7.3'
Check = {
$actual.ModuleVersion | Should -Be '2.7.3'
}
},
@{
Spec = 'Az.Accounts>=2.7.3'
Check = {
$actual.ModuleVersion | Should -BeGreaterThan '2.7.3'
}
},
@{
Spec = 'Az.Accounts:2.7.3'
Check = {
$actual.ModuleVersion | Should -BeGreaterThan '2.7.3' -Because 'With NuGet syntax, a bare version is a minimum version, not a requiredversion'
}
},
@{
Spec = 'Az.Accounts:[2.7.3]'
Check = {
$actual.ModuleVersion | Should -Be '2.7.3'
}
},
@{
Spec = 'Az.Accounts:(,2.7.3)'
Check = {
$actual.ModuleVersion | Should -BeLessThan '2.7.3'
}
},
@{
Spec = '@{ModuleName = ''Az.Accounts''; ModuleVersion = ''2.7.3''}'
Check = {
$actual.ModuleVersion | Should -BeGreaterThan '2.7.3'
}
},
@{
Spec = '@{ModuleName = ''Az.Accounts''; RequiredVersion = ''2.7.3''}'
Check = {
$actual.ModuleVersion | Should -Be '2.7.3'
}
}
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants