Skip to content

The Local Repo

LocalModules additionally supports setting up a local repository for testing PS module publishing.

Intro

When you are ready to publish your module officially, for example to powershellgallery.com, you want to test the publishing process and you can do this with a local file share repository (1).

  1. 2. Kevin Marquette's article about file share repositories.

LocalModules Powershell module additionally enables you to set up a local repository on your system to the folder $HOME\LocalRepo.

Local Repo cmdlets overview

Set-LRepo
Set up a local file share repository named LocalRepo.
Remove-LRepo
Remove the LocalRepo repository and all modules that are contained.

Examples

Setting up the repo:

PS:> Set-LRepo
Checking out LocalRepo:

PS:> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2
LocalRepo                 Trusted              C:\Users\<youser>\LocalRepo

Publishing to LocalRepo:

PS:> Publish-Module -Path <Path/to/modulefolder> -Repository LocalRepo

Installing a module from LocalRepo:

PS:> Install-Module -Name <my_mod_name> -Repository LocalRepo

Removing the repo

PS:> Remove-LRepo