Skip to content

New SampleModule

gaelcolas edited this page Jul 18, 2024 · 1 revision

New-SampleModule

SYNOPSIS

Create a module scaffolding and add samples & build pipeline.

SYNTAX

ByModuleType (Default)

New-SampleModule -DestinationPath <String> [-ModuleType <String>] [-ModuleAuthor <String>] -ModuleName <String>
 [-ModuleDescription <String>] [-CustomRepo <String>] [-ModuleVersion <String>] [-LicenseType <String>]
 [-SourceDirectory <String>] [<CommonParameters>]

ByFeature

New-SampleModule -DestinationPath <String> [-ModuleAuthor <String>] -ModuleName <String>
 [-ModuleDescription <String>] [-CustomRepo <String>] [-ModuleVersion <String>] [-LicenseType <String>]
 [-SourceDirectory <String>] [-Features <String[]>] [<CommonParameters>]

DESCRIPTION

New-SampleModule helps you bootstrap your PowerShell module project by creating a the folder structure of your module, and optionally add the pipeline files to help with compiling the module, publishing to PSGallery and GitHub and testing quality and style such as per the DSC Community guildelines.

EXAMPLES

EXAMPLE 1

New-SampleModule -DestinationPath . -ModuleType CompleteSample -ModuleAuthor "Gael Colas" -ModuleName MyModule -ModuleVersion 0.0.1 -ModuleDescription "a sample module" -LicenseType MIT -SourceDirectory Source

PARAMETERS

-CustomRepo

The Custom PS repository if you want to use an internal (private) feed to pull for dependencies.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: PSGallery
Accept pipeline input: False
Accept wildcard characters: False

-DestinationPath

Destination of your module source root folder, defaults to the current directory ".". We assume that your current location is the module folder, and within this folder we will find the source folder, the tests folder and other supporting files.

Type: String
Parameter Sets: (All)
Aliases: Path

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Features

If you'd rather select specific features from this template to build your module, use this parameter instead.

Type: String[]
Parameter Sets: ByFeature
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LicenseType

Type of license you would like to add to your repository. We recommend MIT for Open Source projects.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: MIT
Accept pipeline input: False
Accept wildcard characters: False

-ModuleAuthor

The author of module that will be populated in the Module Manifest and will show in the Gallery.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $env:USERNAME
Accept pipeline input: False
Accept wildcard characters: False

-ModuleDescription

The Description of your Module, to be used in your Module manifest.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ModuleName

The Name of your Module.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ModuleType

Specifies the type of module to create. The default value is 'SimpleModule'. Preset of module you would like to create: - CompleteSample - SimpleModule - SimpleModule_NoBuild - dsccommunity

Type: String
Parameter Sets: ByModuleType
Aliases:

Required: False
Position: Named
Default value: SimpleModule
Accept pipeline input: False
Accept wildcard characters: False

-ModuleVersion

Version you want to set in your Module Manifest. If you follow our approach, this will be updated during compilation anyway.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 0.0.1
Accept pipeline input: False
Accept wildcard characters: False

-SourceDirectory

How you would like to call your Source repository to differentiate from the output and the tests folder. We recommend to call it 'source', and the default value is 'source'.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Source
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Void

NOTES

See Add-Sample to add elements such as functions (private or public), tests, DSC Resources to your project.

RELATED LINKS

Clone this wiki locally