Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way for easier development and module building #40

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

PrzemyslawKlys
Copy link

@PrzemyslawKlys PrzemyslawKlys commented Nov 24, 2023

Hi,

I saw your module and saw that it has potential, but I also notice that you mostly build it inside 2 files. While from performance perspective this is great, from development and management not so great. With per file code doing PR is much easier for both you and perspective user.

I would like to introduce you to my PowerShell module builder that I used on my own modules:

The module is called PSPublishModule and I actively maintain it fixing bugs, adding new features as I go.

Since I maintain about 60 different modules, and do a lot of releases it's quite painful to do it sort of manually.

This module builder helps to simplify process and checks:

image
image
image

Your project now consists of few folders

  • Private - folder with all your private functions that are 'hidden' for users - I've moved all functions there that I believe are private - creating one file, per each function
  • Public - folder with all your public functions that are available to use for users - I've moved only your main code there.
  • Build - contains build-module - when you run it - you get this:

When you run it goes thru a process of creating single PSM1 and updating PSD1 with proper data.

It goes thru long process but this is what it does in short:

  • It's able to pick the version from PSGallery and propose next version to your code automatically.
  • It's able to pick that you are missing dependencies and stop during build and says you are missing some of modules which then you make decision to add them as RequiredModules, ExternalModules or IgnoreModules.
  • It can format your PSM1/PSD1 files on the go
  • It copies the modules to your Modules folder for PS 5.1 and PS 7
  • It then publishes it from there if you use New-ConfigurationPublish
  • It can also configure Artefacts folder for you New-ConfigurationArftefact

image

  • It automanages PSD1 detecting private / public functions and aliases and adding them to PSD1 (what you see in it is fully generated from that Build-Module.ps1

image

Finaly it can also sign your module or create docs if you have proper configuration.

I did similar PR for another project:

It was accepted and it includes some useful information as well.

Feel free to accept or deny. If you have any questions or need some help with it, let me know.

For the build-module.ps1 to work you need to do

Install-Module PSPublishModule -Verbose

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.

1 participant