Skip to content

Commit c6039ff

Browse files
committed
build(sln): fix and document Repository-Setup script
1 parent d790c44 commit c6039ff

File tree

3 files changed

+20
-41
lines changed

3 files changed

+20
-41
lines changed

Kentico.Xperience.RepoTemplate.sln

-19
This file was deleted.

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## ---Template info---
22

3+
---Run the `Repository-Setup.ps1` in the root of this repository, specifying the `ProjectName` for the new project
4+
---ex: `.\Repository-Setup.ps1 -ProjectName Kentico.Xperience.CoolProject`
5+
36
---This section contains general information about the repository template and is to be deleted before submitting a pull request with the final documentation.---
47

58
---Lines enclosed by three dashes (like this one) are placeholders and comments to be replaced with specific information or deleted completely.---
@@ -57,11 +60,11 @@ dotnet add package <library nuget package name>
5760

5861
---Minimal steps to get started with the library. Support the steps with helpful screenshots.---
5962

60-
---You can completely omit this section if the setup is complicated and cannot be realistically condensed into a few steps. Instead, describe everything in detail in *Usage-Guide.md*.---
63+
---You can completely omit this section if the setup is complicated and cannot be realistically condensed into a few steps. Instead, describe everything in detail in _Usage-Guide.md_.---
6164

6265
## Full Instructions
6366

64-
---Add the full instructions, guidance, and tips to the *Usage-Guide.md* file---
67+
---Add the full instructions, guidance, and tips to the _Usage-Guide.md_ file---
6568

6669
View the [Usage Guide](./docs/Usage-Guide.md) for more detailed instructions.
6770

Repository-Setup.ps1

+15-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## Delete me after project setup!
2+
13
param (
24
[string]$ProjectName
35
)
@@ -12,7 +14,7 @@ $searchText = "Kentico.Xperience.RepoTemplate"
1214
$replaceText = "$ProjectName"
1315

1416
$files = Get-ChildItem -Path "./" `
15-
-Recurse:true | Where-Object {
17+
-Recurse:$true | Where-Object {
1618
@(".json", ".yml", ".props", ".md") -contains $_.Extension
1719
}
1820

@@ -31,42 +33,35 @@ foreach ($file in $files) {
3133
Set-Content -Path $file.FullName -Value $newContent
3234

3335
Write-Host "Replaced text in file: $($file.FullName)"
34-
} else {
35-
Write-Host "No match found in file: $($file.FullName)"
3636
}
3737
}
3838

3939
# Define project directories
40-
$srcProjectPath = "./src/$ProjectName"
41-
$testProjectPath = "./tests/$ProjectName.Tests"
42-
$examplesProjectPath = "./examples/DancingGoat"
40+
$srcProjectPath = Join-Path "./src" $ProjectName
41+
$testProjectPath = Join-Path "./tests" "$ProjectName.Tests"
42+
$examplesProjectPath = Join-Path "./examples" "DancingGoat"
4343

44-
# Create the class library project
4544
dotnet new classlib `
4645
-n $ProjectName `
47-
-o $srcProjectPath
46+
-o $srcProjectPath `
47+
--no-restore
4848
Write-Host "Created class library project: $srcProjectPath"
4949

50-
# Create the NUnit test project
5150
dotnet new nunit `
5251
-n "$ProjectName.Tests" `
53-
-o $testProjectPath
52+
-o $testProjectPath `
53+
--no-restore
5454
Write-Host "Created NUnit test project: $testProjectPath"
5555

56-
# Add reference to the src project in the test project
56+
dotnet new kentico-xperience-sample-mvc -n DancingGoat -o $examplesProjectPath --no-restore --allow-scripts Yes
57+
Write-Host "Created Dancing Goat sample application: $examplesProjectPath"
58+
5759
dotnet add "$testProjectPath/$ProjectName.Tests.csproj" `
58-
reference "$srcProjectPath/$ProjectName.csproj"
60+
reference $srcProjectPath
5961
Write-Host "Added reference from test project to class library project."
6062

61-
# Create the Dancing Goat sample application
62-
dotnet new kentico-xperience-sample-mvc `
63-
-n "DancingGoat" `
64-
-o $examplesProjectPath --allow-scripts
65-
Write-Host "Created Dancing Goat sample application: $examplesProjectPath"
66-
67-
# Add reference to the src project in the Dancing Goat sample application
6863
dotnet add "$examplesProjectPath/DancingGoat.csproj" `
69-
reference "$srcProjectPath/$ProjectName.csproj"
64+
reference $srcProjectPath
7065
Write-Host "Added reference from Dancing Goat project to class library project."
7166

7267
dotnet new sln -n "$ProjectName"

0 commit comments

Comments
 (0)