You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Because we are changing state, we want to be safe
22
22
#TODO: Implement logic to only fail on module installs, such that one module failure doesn't prevent others from installing.
@@ -68,6 +68,11 @@ function Install-ModuleFast {
68
68
69
69
In addition, if you do not already have the %LOCALAPPDATA%\PowerShell\Modules in your $env:PSModulesPath, Modulefast will append a command to add it to your user profile. This is done to ensure that the modules are available for use in future sessions. If you do not want this behavior, you can specify the -NoProfileUpdate switch.
70
70
71
+
-------
72
+
Caching
73
+
-------
74
+
ModuleFast will cache the results of the module selection process in memory for the duration of the PowerShell session. This is done to improve performance when multiple modules are being installed. If you want to clear the cache, you can call Clear-ModuleFastCache.
75
+
71
76
.PARAMETERWhatIf
72
77
If specified, will output the installation plan to the pipeline as well as the console. This can be saved and provided to Install-ModuleFast at a later date.
throw [InvalidOperationException]"$currentModuleSpec`: a matching module was not found in the $Source repository that satisfies the requested version constraints. You may need to specify -PreRelease or adjust your version constraints."
624
+
throw [InvalidOperationException]"${currentModuleSpec}: a matching module was not found in the $Source repository that satisfies the requested version constraints. You may need to specify -PreRelease or adjust your version constraints."
610
625
}
611
626
612
-
Write-Debug"$currentModuleSpec`: Found $(@($pages).Count) additional pages that might match the query: $($pages.'@id'-join',')"
627
+
Write-Debug"${currentModuleSpec}: Found $(@($pages).Count) additional pages that might match the query: $($pages.'@id'-join',')"
613
628
614
629
#TODO: This is relatively slow and blocking, but we would need complicated logic to process it in the main task handler loop.
615
630
#I really should make a pipeline that breaks off tasks based on the type of the response.
@@ -641,7 +656,7 @@ function Get-ModuleFastPlan {
641
656
}
642
657
643
658
if ($currentModuleSpec.SatisfiedBy($candidate)) {
644
-
Write-Debug"$currentModuleSpec`: Found satisfying version $candidate in the additional pages."
659
+
Write-Debug"${currentModuleSpec}: Found satisfying version $candidate in the additional pages."
645
660
$matchingEntry=$entries|Where-Object version -EQ$candidate
646
661
if (-not$matchingEntry) { throw'Multiple matching Entries found for a specific version. This is a bug and should not happen' }
647
662
$matchingEntry
@@ -656,7 +671,7 @@ function Get-ModuleFastPlan {
656
671
)
657
672
658
673
if (-not$selectedEntry) {
659
-
throw [InvalidOperationException]"$currentModuleSpec`: a matching module was not found in the $Source repository that satisfies the version constraints. You may need to specify -PreRelease or adjust your version constraints."
674
+
throw [InvalidOperationException]"${currentModuleSpec}: a matching module was not found in the $Source repository that satisfies the version constraints. You may need to specify -PreRelease or adjust your version constraints."
660
675
}
661
676
if (-not$selectedEntry.PackageContent) { throw"No package location found for $($selectedEntry.PackageContent). This should never happen and is a bug" }
662
677
@@ -687,7 +702,7 @@ function Get-ModuleFastPlan {
687
702
continue
688
703
}
689
704
690
-
Write-Verbose"$selectedModule`: Added to install plan"
705
+
Write-Verbose"${selectedModule}: Added to install plan"
691
706
692
707
# HACK: Pwsh doesn't care about target framework as of today so we can skip that evaluation
693
708
# TODO: Should it? Should we check for the target framework and only install if it matches?
@@ -705,7 +720,7 @@ function Get-ModuleFastPlan {
705
720
706
721
[ModuleFastSpec]::new($PSItem.id,$range)
707
722
}
708
-
Write-Debug"$currentModuleSpec`: has $($dependencies.count) additional dependencies: $($dependencies-join', ')"
723
+
Write-Debug"${currentModuleSpec}: has $($dependencies.count) additional dependencies: $($dependencies-join', ')"
throw"$module`: Existing module folder found at $installPath but the manifest could not be found. This is likely a corrupted or missing module and should be fixed manually."
846
+
throw"${module}: Existing module folder found at $installPath but the manifest could not be found. This is likely a corrupted or missing module and should be fixed manually."
825
847
}
826
848
827
849
#TODO: Dedupe all import-powershelldatafile operations to a function ideally
@@ -851,7 +873,7 @@ function Install-ModuleFastHelper {
851
873
852
874
Write-Verbose"${module}: Downloading from $($module.Location)"
853
875
if (-not$module.Location) {
854
-
throw"$module`: No Download Link found. This is a bug"
876
+
throw"${module}: No Download Link found. This is a bug"
@@ -1402,7 +1424,7 @@ function Get-ModuleInfoAsync {
1402
1424
#HACK: We need the task to be a unique reference for the context mapping that occurs later on, so this is an easy if obscure way to "clone" the task using PowerShell.
1403
1425
$requestTask= [Task]::WhenAll($requestTask)
1404
1426
} else {
1405
-
Write-Debug ('{0}fetch info from {1}'-f ($ModuleId?"$ModuleId`: " : ''),$uri)
1427
+
Write-Debug ('{0}fetch info from {1}'-f ($ModuleId?"${ModuleId}: " : ''),$uri)
@@ -1724,7 +1746,7 @@ function Find-RequiredSpecFile ([string]$Path) {
1724
1746
}
1725
1747
1726
1748
if (-not$requireFiles) {
1727
-
throw [NotSupportedException]"Could not find any required spec files in $Path. Verify the path is correct or specify Module Specifications either via -Path or -Specification"
1749
+
throw [NotSupportedException]"Could not find any required spec files in $Path. Verify the path is correct or provide Module Specifications either via -Path or -Specification"
Copy file name to clipboardExpand all lines: README.MD
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ iwr bit.ly/modulefast | iex
15
15
Install-ModuleFast ImportExcel
16
16
```
17
17
18
+
Modulefast is also accessible via the alias `imf` once loaded
19
+
18
20
The bit.ly link will always point to the latest release of ModuleFast by default. In order to avoid breaking changes, you can pin to a specific release. This is recommended when using CI systems such as GitHub Actions to install dependencies but is generally not needed on an interactive basis.
19
21
20
22
### View the Detailed Help for ModuleFast
@@ -76,11 +78,15 @@ You can alternatively set it as your `powershell.config.json` PSModulePath, add
76
78
77
79
## Goals
78
80
79
-
* Given a set of packages, install the packages and their dependencies as fast as possible in a declarative plan/apply incremental approach.
80
-
* Packages once deployed should be fully compatible with built-in *-Module commands, PSGetv2, and PSGetv3.
81
-
* Support a "plan" view that shows what will change before it changes, Terraform-style
82
-
* Support a dependencies file that can declaratively define what packages a module should have
83
-
* Support a "complete" mode that will clean up packages that aren't the latest versions of the specified modules.
81
+
*[x] Given a set of packages, install the packages and their dependencies as fast as possible in a declarative plan/apply incremental approach.* Support a "plan" view that shows what will change before it changes, Terraform-style
82
+
*[x] Support a "plan" view that shows what will change before it changes, Terraform-style
83
+
*[x] Support a dependencies file that can declaratively define what packages a module should have
84
+
*[x] Packages once deployed should be fully compatible with built-in *-Module commands, PSGetv2, and PSGetv3
85
+
*[x] Support Third Party NuGet v3 Repositories using HTTPS Basic Auth (PAT Tokens etc.)
86
+
*[x] Install requirements for scripts with #Requires statements
87
+
*[ ] Able to use existing PSResourceGet registrations if NuGet v3 Repositories
88
+
89
+
~~Support a "complete" mode that will clean up packages that aren't the latest versions of the specified modules~~ Decided there isn't much value for this if packages are correct
0 commit comments