This is a PowerShell module installer that is optimized for high performance and no external dependencies so it can be used as a bootstrap to quickly install and update modules in a declarative fashion.
ModuleFast can be quickly bootstrapped without relying on the built-in PowershellGet package manager
iwr bit.ly/modulefast | iex
Install-ModuleFast ImportExcel
Modulefast is also accessible via the alias imf
once loaded
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.
iwr bit.ly/modulefast | iex
Get-Help Install-ModuleFast -Full
This syntax allows you to both load and invoke Install-Modulefast. Any additional arguments you pass to the command are the same as if you provided them as arguments to Install-ModuleFast. The module will automatically unload upon completion.
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) -Specification ImportExcel
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 GitHub release. This is recommended when using CI systems such as GitHub Actions to install dependencies but is generally not needed on an interactive basis.
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) -Release 'v0.2.0' -Specification ImportExcel
ModuleFast provides a GitHub Action. Details for usage are on the GitHub Marketplace page.
ModuleFast is supported with AnyPackage, a cross-platform PowerShell unified package management interface. Shorthand specifications are supported. More information is available on the provider page.
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) -Specification AnyPackage.ModuleFast
Import-Module AnyPackage.ModuleFast
AnyPackage\Install-Package -provider ModuleFast -Name 'ImportExcel<4','Pester<4'
You can specify a set of ModuleSpecification
hashtables to Install-ModuleFast for explicit version constraints. For instance,
you can have only a very specific version to be installed, or only versions below a certain to be installed as well.
#Installs the latest ImportExcel lower than 7.7.0
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) @{ModuleName='ImportExcel';MaximumVersion='7.7.0'}
ModuleFast can read a variety of files for module specifications:
You can specify one of these files by using the -Path parameter
. If you run Install-ModuleFast
with no arguments, it will search for *.required.psd1|psm1|json|jsonc files in the current directory to install.
You can specify the -CI
parameter to create a lockfile in the current directory that will pin specific version specifications.
If you commit this to a repository, others who run Install-ModuleFast -CI
will get exactly the modules that were installed
by your installation process, even if newer ones are available that meet the spec. This helps ensure proper
reproducible builds, but ideally you will specify your versions appropriately instead.
ModuleFast installs modules to your LocalAppData/powershell/Modules
folder.
This is the default install folder on Linux however it is not on Windows, so on Windows the
script will automatically update your profile to add this path to your psmodulepath on startup (it will prompt you to do this).
You can alternatively set it as your powershell.config.json
PSModulePath, add it to your PSModulePath another way such as in your profile, or specify -Destination to point wherever you want, such as the classic "Documents" location.
[ ] Able to use existing PSResourceGet registrations if NuGet v3 Repositories
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
pwsh.gallery
, a nuget v2 -> v3 proxy (though any nuget v2 repo could be supported in this fashion)This is an example of how fast things can be, with certain assumptions. It is not a replacement for PowerShellGet, which has much broader support for multiple repos, authentication, etc.
It makes a lot of very bad assumptions, most of which are safe for PowerShell Gallery at least
This module uses a custom dependency resolution algorithm that selects the newest available modules that satisfy all the
dependency criteria. If a version of a locally installed module satisfies the "latest" criteria of the dependency graph,
it will be used rather than fetching what is newest on the gallery. This can be overriden with the -Update
switch that
will recheck whats available in the remote.
This script will use the latest unstable main commit and configure the instance of Modulefast to use preview.pwsh.gallery
as the default repository (you can still override this with the Source parameter). It supports all the same methods and parameters as normal ModuleFast.
& ([scriptblock]::Create((iwr 'bit.ly/modulefastmain'))) -UseMain
Run .\build.ps1
which will install all prerequisites (using ModuleFast!) and compile/test the package. After running it once, you can simply use Invoke-Build
to start a new build. The module will be output into the Build
Directory by default.