Skip to content

Commit 2cc7303

Browse files
committed
📄 Update README for improved clarity and structure
1 parent ba7134d commit 2cc7303

File tree

1 file changed

+48
-40
lines changed

1 file changed

+48
-40
lines changed

README.MD

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
# ModuleFast
44

5-
This is a PowerShell module installer that is optimized for high performance and no external dependencies so it can be
6-
used as a bootstrap to quickly install and update modules in a declarative fashion.
5+
This is a PowerShell module installer that is optimized for:
6+
7+
- ⚡ high performance parallel module installation
8+
- 🚀 Fast Custom PowerShell Gallery mirror by default - [pwsh.gallery](https://github.com/justingrote/gallerysync)
9+
- 📄 declarative syntax
10+
- 👢 bootstrappable with no external dependencies
11+
- ❓ WhatIf Support
12+
- 📃 Manifest/Requires/etc. support
713

814
## Bootstrap Quick Start
915

@@ -41,31 +47,22 @@ The bit.ly link will always point to the latest release of ModuleFast by default
4147
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) -Release 'v0.2.0' -Specification ImportExcel
4248
```
4349

44-
### Module Specification Syntax
45-
46-
ModuleFast introduces a shorthand string syntax for defining module specifications. It generally takes the form of `<ModuleName><Operator><Version>`. The version supports SemVer 2 and prerelease tags.
47-
48-
The available operators are:
49-
- `=`: Exact version match. Examples: `ImportExcel=7.1.0`, `ImportExcel=7.1.0-preview`
50-
- `>`: Greater than. Example: `ImportExcel>7.1.0`
51-
- `>=`: Greater than or equal to. Example: `ImportExcel>=7.1.0`
52-
- `<`: Less than. Example: `ImportExcel<7.1.0`
53-
- `<=`: Less than or equal to. Example: `ImportExcel<=7.1.0`
54-
- `!`: A prerelease operator that can be present at the beginning or end of a module name to indicate that prerelease versions are acceptable. Example: `ImportExcel!`, `!ImportExcel`. It can be combined with the other operators like so: 'ImportExcel!>7.1.0'
55-
- `:`: Lets you specify a NuGet version range. Example: `ImportExcel:(7.0.0, 7.2.1-preview]`
56-
57-
For more information about NuGet version range syntax used with the ':' operator: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges. Wilcards are supported with this syntax e.g. 'ImportExcel:3.2.*' will install the latest 3.2.x version.
50+
### Specify Specific Modules with Module Specification Syntax
5851

59-
ModuleFast also fully supports the ModuleSpecification object and hashtable-like string syntaxes that are used by Install-Module and Install-PSResource. More information on this format: https://learn.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.modulespecification?view=powershellsdk-7.4.0
52+
```powershell
53+
Install-ModuleFast 'ImportExcel>7.1.0','Az.Resources','IPNetwork=0.1.0'
54+
```
6055

61-
### Logging
62-
Modulefast has extensive Verbose and Debug information available if you specify the -Verbose and/or -Debug parameters. This can be useful for troubleshooting or understanding how ModuleFast is working. Verbose level provides a high level "what" view of the process of module selection, while Debug level provides a much more detailed "Why" information about the module selection and installation process that can be useful in troubleshooting issues.
56+
### Specify Modules via #requires syntax
57+
```powershell
58+
#require -module ImportExcel,Az.Resources.IPNetwork
59+
```
6360

64-
### ![alt text](images/README/image.png) GitHub Action
61+
## ![alt text](images/README/image.png) GitHub Action
6562

6663
ModuleFast provides a [GitHub Action](https://github.com/marketplace/actions/modulefast). Details for usage are on the GitHub Marketplace page.
6764

68-
### AnyPackage
65+
## AnyPackage
6966

7067
ModuleFast is supported with [AnyPackage](https://github.com/anypackage/anypackage), a cross-platform PowerShell unified package management interface. Shorthand specifications are supported. More information is available on the provider page.
7168

@@ -75,15 +72,32 @@ Import-Module AnyPackage.ModuleFast
7572
AnyPackage\Install-Package -provider ModuleFast -Name 'ImportExcel<4','Pester<4'
7673
```
7774

78-
### ModuleSpecification Install
75+
## Module Specification Syntax
7976

80-
You can specify a set of `ModuleSpecification` hashtables to Install-ModuleFast for explicit version constraints. For instance,
81-
you can have only a very specific version to be installed, or only versions below a certain to be installed as well.
77+
ModuleFast introduces a shorthand string syntax for defining module specifications. It generally takes the form of `<ModuleName><Operator><Version>`. The version supports SemVer 2 and prerelease tags.
8278

83-
```powershell
84-
#Installs the latest ImportExcel lower than 7.7.0
85-
& ([scriptblock]::Create((iwr 'bit.ly/modulefast'))) @{ModuleName='ImportExcel';MaximumVersion='7.7.0'}
86-
```
79+
The available operators are:
80+
- `=`: Exact version match. Examples: `ImportExcel=7.1.0`, `ImportExcel=7.1.0-preview`
81+
- `>`: Greater than. Example: `ImportExcel>7.1.0`
82+
- `>=`: Greater than or equal to. Example: `ImportExcel>=7.1.0`
83+
- `<`: Less than. Example: `ImportExcel<7.1.0`
84+
- `<=`: Less than or equal to. Example: `ImportExcel<=7.1.0`
85+
- `!`: A prerelease operator that can be present at the beginning or end of a module name to indicate that prerelease versions are acceptable. Example: `ImportExcel!`, `!ImportExcel`. It can be combined with the other operators like so: 'ImportExcel!>7.1.0'
86+
- `:`: Lets you specify a NuGet version range. Example: `ImportExcel:(7.0.0, 7.2.1-preview]`
87+
88+
For more information about NuGet version range syntax used with the ':' operator: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-ranges. Wilcards are supported with this syntax e.g. `ImportExcel:3.2.*` will install the latest 3.2.x version.
89+
90+
ModuleFast also fully supports the [ModuleSpecification object and hashtable-like string syntaxes](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_requires?view=powershell-7.5#-modules-module-name--hashtable) that are used by Install-Module and Install-PSResource. More information on this format: https://learn.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.modulespecification?view=powershellsdk-7.4.0
91+
92+
## Logging
93+
ModuleFast has extensive Verbose and Debug information available if you specify the -Verbose and/or -Debug parameters. This can be useful for troubleshooting or understanding how ModuleFast is working. Verbose level provides a high level "what" view of the process of module selection, while Debug level provides a much more detailed "Why" information about the module selection and installation process that can be useful in troubleshooting issues.
94+
95+
## Dependency Resolution
96+
97+
This module uses a custom dependency resolution algorithm that selects the newest available modules that satisfy all the
98+
dependency criteria. If a version of a locally installed module satisfies the "latest" criteria of the dependency graph,
99+
it will be used rather than fetching what is newest on the gallery. This can be overriden with the `-Update` switch that
100+
will recheck whats available in the remote.
87101

88102
### Requires Spec Installation
89103

@@ -92,6 +106,7 @@ ModuleFast can read a variety of files for module specifications:
92106
1. .ps1 PowerShell Scripts with #Requires comment
93107
1. .psm1 PowerShell Modules with #Requires comment
94108
1. .psd1 Module Manifest with a RequiredModules property
109+
1. .psd1 File in [PSDepend](https://github.com/RamblingCookieMonster/PSDepend) format
95110
1. .psd1 file with module/version pairs
96111
1. .json file with module/version pairs
97112
1. .json file with array of Module Specification strings
@@ -136,11 +151,11 @@ PSGetv3 is compatibility, the focus with ModuleFast is speed of installation/upd
136151
1. Takes your module specifications and builds a declarative dependency tree, following a IaC plan/apply approach to installing modules. By default it will evaluate locally installed modules in all of your configured PSModulePath to determine if an already-installed module meets the criteria.
137152
1. Uses a custom HTTPClient and async tasks to build the dependency tree quickly, querying with minimal data possible and using batch queries where possible to optimize for performance. This is all done in native PowerShell, no C# required (though C# would allow for certain operations to be even more parallelizable by chaining tasks).
138153
1. Uses HTTP/2 to run all queries in a single TCP conversation where possible (PSGallery supports it)
139-
1. For PowerShell Gallery, uses an optimized [CloudFlare Worker](https://github.com/justingrote/pwshgallery) to resolve dependencies as fast as possible.
154+
1. A custom nuget v3 mirror of PowerShell Gallery called pwsh.gallery uses Sleet to mirror all PowerShell Gallery packages and is fronted by Cloudflare for high performance, high availability, and data locality.
140155

141156
## What this script is not
142157

143-
This is an example of how fast things *can* be, with certain assumptions. It is *not* a replacement for
158+
ModuleFast is an implementation focusing on of how fast things *can* be, with certain assumptions. It is *not* a replacement for
144159
PowerShellGet, which has much broader support for multiple repos, authentication, etc.
145160

146161
It makes a lot of very bad assumptions, most of which are safe for PowerShell Gallery at least
@@ -160,21 +175,14 @@ It makes a lot of very bad assumptions, most of which are safe for PowerShell Ga
160175
1. Initially the logic would fetch the main page and resolve dependencies by fetching individual versions. Turns out its only barely slower to return all versions of a module in single call, probably because the PSGallery server-side filtering doesnt cache, so we instead fetch all versions of a module in a reduced way from our Cloudflare worker and use that as a cache.
161176
1. Parallel dependency lookups (lots of Az dependencies require Az.Account) resulted in lots of duplicate calls for Az.Account. Since all task calls bottleneck through our main async loop logic, we can safely inspect existing dependency calls just before execution to determine if the existing call will satisfy it, and then add the context on to the existing object to prevent the duplicate calls.
162177

163-
## Dependency Resolution
178+
# Development
164179

165-
This module uses a custom dependency resolution algorithm that selects the newest available modules that satisfy all the
166-
dependency criteria. If a version of a locally installed module satisfies the "latest" criteria of the dependency graph,
167-
it will be used rather than fetching what is newest on the gallery. This can be overriden with the `-Update` switch that
168-
will recheck whats available in the remote.
180+
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.
169181

170-
### Testing Latest Commit
182+
## Testing Latest Commit
171183

172184
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.
173185

174186
```powershell
175187
& ([scriptblock]::Create((iwr 'bit.ly/modulefastmain'))) -UseMain
176188
```
177-
178-
# Development
179-
180-
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.

0 commit comments

Comments
 (0)