Skip to content

Commit 1ebace0

Browse files
committed
updated in the nuget packaging
1 parent fee7865 commit 1ebace0

File tree

5 files changed

+72
-39
lines changed

5 files changed

+72
-39
lines changed

.github/workflows/template-publish.yml

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ jobs:
8282
# Copy as main README.md in the template output root
8383
Copy-Item -Path "./template-src/README.template.md" -Destination "./template-output/README.md"
8484
85-
# Create docs directory for NuGet's readme reference
86-
New-Item -Path "./template-output/docs" -ItemType Directory -Force
87-
Copy-Item -Path "./template-src/README.template.md" -Destination "./template-output/docs/README.md"
85+
Write-Host "✅ README file set up successfully at template-output/README.md"
8886
89-
Write-Host "✅ README files set up successfully"
90-
}
87+
# Verify the file exists and has content
88+
if (Test-Path "./template-output/README.md") {
89+
$fileContent = Get-Content -Path "./template-output/README.md" -Raw
90+
$contentLength = $fileContent.Length
91+
Write-Host "README.md file size: $contentLength bytes"
92+
} else {
93+
Write-Error "README.md was not copied correctly"
94+
}
95+
} else {
96+
Write-Error "README.template.md not found in template-src directory"
9197
9298
- name: Copy and update .nuspec file
9399
shell: pwsh
@@ -153,6 +159,29 @@ jobs:
153159
run: |
154160
nuget pack ./template-output/CleanArchitecture.FullStack.Template.nuspec -OutputDirectory ./nupkg
155161
162+
- name: Verify template package contents
163+
shell: pwsh
164+
run: |
165+
# Extract and verify the NuGet package contents to ensure README is included
166+
$packagePath = Get-ChildItem -Path "./nupkg/*.nupkg" | Select-Object -First 1 -ExpandProperty FullName
167+
$extractPath = "./nupkg-extracted"
168+
169+
Write-Host "Extracting NuGet package to verify contents..."
170+
if (Test-Path $extractPath) {
171+
Remove-Item -Path $extractPath -Recurse -Force
172+
}
173+
New-Item -Path $extractPath -ItemType Directory | Out-Null
174+
175+
# Extract the package using NuGet
176+
nuget install CleanArchitecture.FullStack.Template -Source "./nupkg" -OutputDirectory $extractPath -ExcludeVersion
177+
178+
# Verify README exists
179+
$readmePath = "$extractPath/CleanArchitecture.FullStack.Template/README.md"
180+
if (Test-Path $readmePath) {
181+
Write-Host "✅ README.md exists in the NuGet package"
182+
} else {
183+
Write-Error "❌ README.md is missing from the NuGet package"
184+
156185
- name: Test template package
157186
run: |
158187
dotnet new install ./nupkg/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}.nupkg
@@ -163,22 +192,19 @@ jobs:
163192
dotnet new --list | findstr "cleanarch"
164193
165194
# Create project from template with parameters from template.json
166-
dotnet new cleanarch --organization TestCompany --projectName TestProject
195+
# Test both with camelCase and PascalCase to verify both work
196+
dotnet new cleanarch-fullstack --Organization TestCompany --ProjectName TestProject
167197
168198
# List files to verify creation
169199
dir
170200
171201
- name: Test template package with organization
172202
run: |
173-
dotnet new install ./nupkg/CleanArchitecture.FullStack.Template.${{ env.TEMPLATE_VERSION }}.nupkg
174203
mkdir test-project-with-org
175204
cd test-project-with-org
176205
177-
# Verify template installed correctly
178-
dotnet new --list | findstr "cleanarch"
179-
180206
# Create project from template with organization parameter
181-
dotnet new cleanarch --organization TestCompany --projectName TestProjectWithOrg
207+
dotnet new cleanarch-fullstack --organization TestCompany --projectName TestProjectWithOrg
182208
183209
# List files to verify creation
184210
dir
@@ -189,7 +215,7 @@ jobs:
189215
cd test-project-no-org
190216
191217
# Create project from template without organization parameter
192-
dotnet new cleanarch --projectName TestProjectNoOrg
218+
dotnet new cleanarch-fullstack --projectName TestProjectNoOrg
193219
194220
# List files to verify creation
195221
dir
@@ -200,7 +226,7 @@ jobs:
200226
cd test-project-no-angular
201227
202228
# Create project from template without Angular
203-
dotnet new cleanarch --organization TestCompany --projectName TestProjectNoAngular --includeAngular false
229+
dotnet new cleanarch-fullstack --organization TestCompany --projectName TestProjectNoAngular --includeAngular false
204230
205231
# Verify that frontend directory is not created
206232
if (Test-Path "./frontend") {
@@ -215,7 +241,7 @@ jobs:
215241
shell: pwsh
216242
run: |
217243
# Test with organization - should create folder YourCompany.TestProject
218-
dotnet new cleanarch --organization YourCompany --projectName TestProject
244+
dotnet new cleanarch-fullstack --Organization YourCompany --ProjectName TestProject
219245
220246
if (Test-Path "YourCompany.TestProject") {
221247
Write-Host "✅ YourCompany.TestProject folder created successfully"
@@ -225,7 +251,7 @@ jobs:
225251
}
226252
227253
# Test without organization - should create folder TestProjectNoOrg
228-
dotnet new cleanarch --projectName TestProjectNoOrg
254+
dotnet new cleanarch-fullstack --ProjectName TestProjectNoOrg
229255
230256
if (Test-Path "TestProjectNoOrg") {
231257
Write-Host "✅ TestProjectNoOrg folder created successfully"
@@ -235,7 +261,7 @@ jobs:
235261
}
236262
237263
# Test with explicit output folder
238-
dotnet new cleanarch --organization YourCompany --projectName TestProject -o CustomFolder
264+
dotnet new cleanarch-fullstack --Organization YourCompany --ProjectName TestProject -o CustomFolder
239265
240266
if (Test-Path "CustomFolder") {
241267
Write-Host "✅ CustomFolder created successfully"

template-src/CleanArchitecture.FullStack.Template.nuspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
<license type="expression">MIT</license>
1515
<projectUrl>https://github.com/nitin27may/clean-architecture-docker-dotnet-angular</projectUrl>
1616
<requireLicenseAcceptance>false</requireLicenseAcceptance>
17-
<copyright>Copyright © Nitin Singh 2024</copyright>
17+
<copyright>Copyright © Nitin Singh 2025</copyright>
1818
<summary>A full-stack template using Clean Architecture principles with .NET 9 API backend and Angular 19 frontend, containerized with Docker.</summary>
19-
<readme>docs\README.md</readme>
19+
<readme>README.md</readme>
2020
</metadata>
2121
<files>
2222
<!-- Include all template content files but exclude binaries and temp files -->
23-
<file src="**\*" target="content" exclude="**\bin\**;**\obj\**;**\.git\**;**\.vs\**;**\.vscode\**;**\node_modules\**;**\.angular\**;**\docs\**" />
23+
<file src="**\*" target="content" exclude="**\bin\**;**\obj\**;**\.git\**;**\.vs\**;**\.vscode\**;**\node_modules\**;**\.angular\**;docs\**;*.nuspec" />
2424

2525
<!-- Explicitly include the README for NuGet package display -->
26-
<file src="docs\README.md" target="docs\" />
26+
<file src="README.md" target="" />
2727
</files>
2828
</package>

template-src/CreateTemplate.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ $templateJson = @{
148148
defaultValue = "YourCompany"
149149
replaces = $OrganizationNamespace
150150
}
151+
ProjectName = @{
152+
type = "parameter"
153+
datatype = "string"
154+
description = "Name of the project that will be used throughout the solution."
155+
defaultValue = "MyApp"
156+
replaces = "ProjectNamePlaceholder"
157+
}
151158
SkipRestore = @{
152159
type = "parameter"
153160
datatype = "bool"
@@ -161,7 +168,6 @@ $templateJson = @{
161168
defaultValue = $true
162169
}
163170
}
164-
# Modified sources configuration to fix validation errors
165171
sources = @(
166172
@{
167173
modifiers = @(

template-src/README.template.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ This template provides a starting point for creating a Clean Architecture soluti
2222

2323
```bash
2424
# Create with organization - output folder will be "YourCompany.MyApp"
25-
dotnet new cleanarch --organization YourCompany --projectName MyApp
25+
dotnet new cleanarch-fullstack --Organization YourCompany --ProjectName MyApp
2626

2727
# Create without organization - output folder will be just "MyApp"
28-
dotnet new cleanarch --projectName MyApp
28+
dotnet new cleanarch-fullstack --ProjectName MyApp
2929

3030
# Create in a specific folder (overrides default folder behavior)
31-
dotnet new cleanarch --organization YourCompany --projectName MyApp -o CustomFolder
31+
dotnet new cleanarch-fullstack --Organization YourCompany --ProjectName MyApp -o CustomFolder
3232
```
3333

3434
3. **Navigate to the project directory:**
@@ -56,58 +56,58 @@ This template provides a starting point for creating a Clean Architecture soluti
5656

5757
```bash
5858
# Full-stack application with organization name
59-
dotnet new cleanarch --organization Acme --projectName ECommerce
59+
dotnet new cleanarch-fullstack --Organization Acme --ProjectName ECommerce
6060

6161
# Full-stack application without organization name
62-
dotnet new cleanarch --projectName ECommerce
62+
dotnet new cleanarch-fullstack --ProjectName ECommerce
6363
```
6464

6565
### Backend-only Application
6666

6767
```bash
6868
# Create backend-only application (exclude Angular)
69-
dotnet new cleanarch --organization Acme --projectName ApiService --includeAngular false
69+
dotnet new cleanarch-fullstack --Organization Acme --ProjectName ApiService --includeAngular false
7070

7171
# Backend-only application without organization name
72-
dotnet new cleanarch --projectName ApiService --includeAngular false
72+
dotnet new cleanarch-fullstack --ProjectName ApiService --includeAngular false
7373
```
7474

7575
### Custom Output Location
7676

7777
```bash
7878
# Specify a custom output folder
79-
dotnet new cleanarch --organization Acme --projectName ECommerce -o ./projects/ecommerce-app
79+
dotnet new cleanarch --Organization Acme --ProjectName ECommerce -o ./projects/ecommerce-app
8080

8181
# Specify output folder without organization name
82-
dotnet new cleanarch --projectName ECommerce -o ./projects/ecommerce-app
82+
dotnet new cleanarch --ProjectName ECommerce -o ./projects/ecommerce-app
8383
```
8484

8585
### Combining Options
8686

8787
```bash
8888
# Backend-only application with custom output folder
89-
dotnet new cleanarch --organization Acme --projectName ApiService --includeAngular false -o ./apis/service
89+
dotnet new cleanarch --Organization Acme --ProjectName ApiService --includeAngular false -o ./apis/service
9090

9191
# Full options example
92-
dotnet new cleanarch --organization Acme --projectName ECommerce --includeAngular true -o ./projects/ecommerce-app
92+
dotnet new cleanarch --Organization Acme --ProjectName ECommerce --includeAngular true -o ./projects/ecommerce-app
9393
```
9494

9595
## Template Parameters
9696

97-
- `--organization`: Optional organization or company name to be used in namespaces. If specified, namespaces will be formatted as `YourCompany.MyApp.Feature`. If not specified, namespaces will be formatted as `MyApp.Feature`.
98-
- `--projectName`: The name of the project. Default is `MyApp`.
97+
- `--Organization`: Optional organization or company name to be used in namespaces. If specified, namespaces will be formatted as `YourCompany.MyApp.Feature`. If not specified, namespaces will be formatted as `MyApp.Feature`.
98+
- `--ProjectName`: The name of the project. Default is `MyApp`.
9999
- `--includeAngular`: Boolean flag to indicate whether to include the Angular frontend project. Default is `true`.
100-
- `-o|--output`: Optional parameter to specify a custom output folder. If not specified, the output folder will be `<organization>.<projectName>` if organization is provided, or just `<projectName>` if it isn't.
100+
- `-o|--output`: Optional parameter to specify a custom output folder. If not specified, the output folder will be `<Organization>.<ProjectName>` if organization is provided, or just `<ProjectName>` if it isn't.
101101

102102
## Output Folder Naming
103103

104104
The template uses the following rules to determine the output folder name:
105105

106106
| Command Parameters | Output Folder |
107107
| ------------------ | ------------- |
108-
| `--organization YourCompany --projectName MyApp` | `YourCompany.MyApp` |
109-
| `--projectName MyApp` (no organization) | `MyApp` |
110-
| `--organization YourCompany --projectName MyApp -o CustomFolder` | `CustomFolder` |
108+
| `--Organization YourCompany --ProjectName MyApp` | `YourCompany.MyApp` |
109+
| `--ProjectName MyApp` (no organization) | `MyApp` |
110+
| `--Organization YourCompany --ProjectName MyApp -o CustomFolder` | `CustomFolder` |
111111

112112
## Directory Structure
113113

template-src/template.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Clean Architecture Docker Angular",
66
"identity": "NitinSoft.CleanArch.Template",
77
"groupIdentity": "NitinSoft.CleanArch.Template",
8-
"shortName": "cleanarch",
8+
"shortName": "cleanarch-fullstack",
99
"sourceName": "ProjectNamePlaceholder",
1010
"preferNameDirectory": true,
1111
"tags": {
@@ -23,6 +23,7 @@
2323
"projectName": {
2424
"type": "parameter",
2525
"datatype": "text",
26+
"description": "Name of the project that will be used throughout the solution.",
2627
"defaultValue": "MyApp",
2728
"replaces": "ProjectNamePlaceholder"
2829
},

0 commit comments

Comments
 (0)