Skip to content

Commit a0c80f6

Browse files
committed
docs: Update ReadMe instructions
1 parent 0939a90 commit a0c80f6

File tree

1 file changed

+55
-12
lines changed

1 file changed

+55
-12
lines changed

ReadMe.md

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
🚧 This repo is still a work in progress and not yet ready to be used 🚧
44

5-
A template repository to create new PowerShell modules quickly with boilerplate files and CI/CD workflows already defined.
5+
A template repository and module for creating new PowerShell module repos quickly with boilerplate files and CI/CD workflows already defined.
66

77
## ✨ Features
88

9-
Use this template for your new git repository to get the following features out-of-the-box:
9+
Use this template/module for your new git repository to get the following features out-of-the-box:
1010

1111
- GitHub Actions workflows or Azure DevOps Pipelines YAML files that:
1212
- Publish a prerelease version on every commit to the `main` branch, and a stable version once manually approved.
@@ -21,39 +21,82 @@ Use this template for your new git repository to get the following features out-
2121
- A `.devcontainer` for use with Visual Studio Code's [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and [GitHub Codespaces](https://github.com/features/codespaces).
2222
- Boilerplate repository files, such as ReadMe, License, Changelog, .gitignore, .editorconfig, PR and Issue templates, and more.
2323

24-
## 📄 Template setup instructions
24+
## 🚀 Get started
2525

26-
Use this template to create a new repository for your PowerShell module.
27-
Follow the instructions below to get started.
26+
There are two ways to create your new PowerShell module repository:
27+
28+
1. Use the `New-PowerShellScriptModuleRepository` cmdlet to create a new repository, or
29+
1. Create a new repository from this template in GitHub.
30+
31+
Both of these methods are described in more detail below.
32+
33+
Once the repository is created, follow the instructions in the repo's ReadMe file to complete the setup.
34+
The non-transformed instructions can also be [viewed here](/src/Template.PowerShell.ScriptModule/TemplateRepoFiles/ReadMe.md).
35+
36+
## 📂 Method 1: Use the New-PowerShellScriptModuleRepository cmdlet
37+
38+
Step 1: Install the `Template.PowerShell.ScriptModule` module from the PowerShell Gallery:
39+
40+
```powershell
41+
Install-Module -Name Template.PowerShell.ScriptModule -Scope CurrentUser
42+
```
43+
44+
Step 2: Create the new repository files:
45+
46+
```powershell
47+
New-PowerShellScriptModuleRepository -RepositoryDirectoryPath 'C:\MyModuleName' -ModuleName 'MyModuleName' -OrganizationName 'My Name'
48+
```
49+
50+
The above command will create a new directory at `C:\MyModuleName` with the boilerplate files and workflows for publishing your module already set up.
51+
52+
You can then perform a `git init` in that directory and push it to where you want your git repository hosted (e.g. Azure DevOps or GitHub).
53+
54+
To complete the setup, follow the instructions in the repo's ReadMe file.
55+
56+
## 📄 Method 2: Create repository from GitHub template
57+
58+
If you repository will be hosted on GitHub, you can follow the steps below:
2859

2960
### 🗍 Step 1: Create a new repo from this template
3061

3162
The official docs for creating a new repository from a template can [be found here](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).
3263
In short, the steps are:
3364

3465
1. Click the `Use this template` button at the top of the repository and choose `Create a new repository`.
35-
1. Name your new repository (including your module name is a good idea) and give it a description.
66+
1. Name your new repository (including your module's name is a good idea) and give it a description.
3667
1. Click the `Create repository` button.
3768
1. You should now have the new repository in your account with the name you chose.
3869
1. Clone your new repository to your local machine to start making changes to it.
3970

4071
### 🤖 Step 2: Replace repo template information
4172

4273
Run the [_InitializeRepository.ps1](/_InitializeRepository.ps1) script to update the repository files with your module's information.
43-
You will be prompted to enter the following information:
74+
You will be prompted to enter some information, such as:
4475

4576
- Your module's name (no spaces)
4677
- Your name or organization name (may contain spaces)
4778

48-
Once the script completes, most of the repo files will be replaced and there will be some additional steps to follow in the [new ReadMe file](/src/Template.PowerShell.ScriptModule/TemplateRepoFiles/ReadMe.md) that replaces this one.
79+
Once the script completes, most of the repo files will be replaced.
80+
You should commit the changes.
81+
82+
To complete the setup, follow the instructions in the repo's new ReadMe file (that replaced this one).
4983

5084
## 📋 Create your own template (optional)
5185

52-
Now that you have the repository looking the way you want, you may want to use it as a template for your future modules so that you don't have to make all of the same changes each time.
53-
In GitHub, from the repo's `Settings` tab under the `General` section, you can rename the repository to reflect that it is a template and check the box to make it a `Template repository`.
86+
Not happy with some of the default template configurations?
87+
Maybe you don't like the .editorconfig settings, or want it to publish to your own internal PowerShell Gallery feed by default?
88+
You can derive your own template from this repository and use it for your future modules, minimizing the custom changes you need to make every time you create a new repo.
89+
90+
To create your own template:
91+
92+
1. Fork [this repository on GitHub](https://github.com/deadlydog/Template.PowerShell.ScriptModule).
93+
1. In GitHub, from your repo's `Settings` tab under the `General` section, rename the repository to reflect that it is a template and check the box to make it a `Template repository`.
94+
1. Modify [the template repo files](/src/Template.PowerShell.ScriptModule/TemplateRepoFiles/) with whatever customizations you want.
95+
1. If you are introducing more replacement tokens in the files, you will need to update the `Set-TemplateTokenValuesInAllRepositoryFiles` function in the [Template.PowerShell.ScriptModule.psm1](/src/Template.PowerShell.ScriptModule/Template.PowerShell.ScriptModule.psm1) file to handle them.
96+
97+
You can now create new repositories from your GitHub template in the same way you would use this one.
5498

55-
The caveat here is you have already ran the script that updated the repository files with your module's name and other information.
56-
In your template repo, you would want to add instructions to do a find-and-replace on the repository files to update the module's name, and any other information you want changed for new modules created from your template.
99+
If you want to be able to create new repositories from a module, you will need to publish your module under a different name.
57100

58101
## ❤ Donate to support this template (optional)
59102

0 commit comments

Comments
 (0)