Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbroeglin/Forge.Module

Forge generator for PowerShell modules
https://github.com/dbroeglin/Forge.Module

forge forge-generators git module pester powershell scaffolding visual-studio-code

Last synced: about 1 month ago
JSON representation

Forge generator for PowerShell modules

Awesome Lists containing this project

README

        

[![Build status](https://ci.appveyor.com/api/projects/status/iqnrxl6xuew4suu8?svg=true)](https://ci.appveyor.com/project/dbroeglin/forge-module)

# Forge Generator for PowerShell modules

This module contains Forge generators for PowerShell modules.
`New-ForgeModule` generates a new module and `New-ForgeModuleFunction` generates a new
function inside an already created module.

The generator is still quite new (and probably a bit opinionated) parts of the structure
come from the excellent https://github.com/devblackops/NetScaler module and quite a bit of
the rest comes from another similar project https://github.com/PowerShell/Plaster

# Installation

Install-Module Forge.Module

# Example

The following commands should generate a module named `PoshTodo`:

New-ForgeModule -Name PoshTodo -License MIT -Author Léa -Email [email protected] -Layout ModuleName

Would create, in the current directory a scaffold for module `PoshTodo` with the following
structure:

./PoshTodo
├── LICENSE
├── PoshTodo
│   ├── PoshTodo.psd1
│   └── PoshTodo.psm1
├── README.md
└── Tests

A skeleton function with associated Pester test file can then be generated by executing:

cd PoshTodo
New-ForgeModuleFunction -Name New-PoshTodo

Which produces the following result:

./PoshTodo
├── LICENSE
├── PoshTodo
│   ├── New-PoshTodo.ps1
│   ├── PoshTodo.psd1
│   └── PoshTodo.psm1
├── README.md
└── Tests
├── Manifest.Tests.ps1
└── New-PoshTodo.Tests.ps1

Adding the `-Editor VSCode` parameter will generate workspace configuration files for the
_Visual Studio Code_ editor. For instance, it will generate a list of task that allow to
run tests and other lifecycle operations from inside the editor.

Depending on your preferences the module can be generated with two different build systems
(or none if you do not need or want one).

To generate PSake integration:

New-ForgeModule -Name PoshTodo -Build PSake

To generate InvokeBuild integration:

New-ForgeModule -Name PoshTodo -Build InvokeBuild

With all options activated we get:

New-ForgeModule -Name PoshTodo -License MIT -Author Léa -Email [email protected] `
-Editor VSCode -Build PSake `
-Description "A Powershell TODO list handler" `
-Layout ModuleName

Which would generate the following project:

./PoshTodo
├── LICENSE
├── PoshTodo
│   ├── PoshTodo.psd1
│   └── PoshTodo.psm1
├── README.md
├── ScriptAnalyzerSettings.psd1
├── Tests
│   └── Manifest.Tests.ps1
├── build.ps1
├── build.psake.ps1
└── build.settings.ps1

# Dependencies

## Run time

At run time, the following modules are required:

Install-Module Forge

## Build time

Additionally, at build time, the following modules are required:

Install-Module Pester