Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script updates #951

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .azure/checks.ps1

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches: [ main ]
paths-ignore:
- '.scripts/**'
- .gitignore
- CODE_OF_CONDUCT.md
- LICENSE
Expand Down
29 changes: 29 additions & 0 deletions .scripts/checks.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Check if Azure CLI is installed
$azPath = (Get-Command az -ErrorAction SilentlyContinue).Source
if (-not $azPath) {
throw "Azure CLI (az) is not installed. Please install it and try again."
}

# Check if Azure CLI is authenticated
az account show --output none
if ($LASTEXITCODE -ne 0) {
throw "Azure CLI (az) is not authenticated. Please authenticate with Azure CLI and try again."
}

# Check if GitHub CLI is installed
$ghPath = (Get-Command gh -ErrorAction SilentlyContinue).Source
if (-not $ghPath) {
throw "GitHub CLI (gh) is not installed. Please install it and try again."
}

# Check if GitHub CLI is authenticated
gh auth status | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "GitHub CLI (gh) is not authenticated. Please authenticate with GitHub CLI and try again."
}

# Check if Git repo is initialised
git status | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "The Git repository has not been initialised. Please create a new GitHub repository and try again."
}
11 changes: 10 additions & 1 deletion .azure/cleanup.ps1 → .scripts/cleanup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ Param(
[String]$ProjectName
)

. ".\checks.ps1"
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$checksScript = Join-Path $scriptRoot "checks.ps1"

try {
. $checksScript
} catch {
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host "Setup script terminated due to the checks failure." -ForegroundColor Red
exit 1
}

$MissingParameterValues = $false

Expand Down
File renamed without changes.
16 changes: 13 additions & 3 deletions .azure/setup.ps1 → .scripts/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ Param(
[String]$AzureSqlLogin = "SqlAdmin"
)

. ".\checks.ps1"
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$checksScript = Join-Path $scriptRoot "checks.ps1"
$environmentsFile = Join-Path $scriptRoot "environments.json"

try {
. $checksScript
} catch {
Write-Host $_.Exception.Message -ForegroundColor Red
Write-Host "Setup script terminated due to the checks failure." -ForegroundColor Red
exit 1
}

$MissingParameterValues = $false

Expand Down Expand Up @@ -52,7 +62,7 @@ if (-not $ProjectName) {

$repoUrl = "https://github.com/$GitHubOrganisationName/$GitHubRepositoryName"

$environments = Get-Content -Raw -Path "environments.json" | ConvertFrom-Json
$environments = Get-Content -Raw -Path $environmentsFile | ConvertFrom-Json

$ParametersTableData = @{
"AzureLocation" = $AzureLocation
Expand All @@ -72,7 +82,7 @@ $ParametersTableData | Format-Table -AutoSize

if ($MissingParameterValues) {
Write-Host "Script execution cancelled. Missing parameter values." -ForegroundColor Red
return
exit 1
}

$EnvironmentTableData = foreach ($environment in $environments.PSObject.Properties) {
Expand Down
4 changes: 2 additions & 2 deletions CleanArchitecture.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<metadata>

<id>Clean.Architecture.Solution.Template</id>
<version>8.0.0-preview.6.10</version>
<version>8.0.0-preview.6.11</version>
<title>Clean Architecture Solution Template</title>
<authors>JasonTaylorDev</authors>
<description>Clean Architecture Solution Template for .NET 8.</description>
<summary>
A Clean Architecture Solution Template for creating apps using Angular, React, or Web API only with ASP.NET Core.
</summary>
<releaseNotes>
General improvements and bug fixes.
General improvements for supporting scripts.
</releaseNotes>

<projectUrl>https://github.com/JasonTaylorDev/CleanArchitecture</projectUrl>
Expand Down
4 changes: 2 additions & 2 deletions README-template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CleanArchitecture

The project was generated using the [Clean.Architecture.Solution.Template](https://github.com/jasontaylordev/CleanArchitecture) version 8.0.0-preview.6.10.
The project was generated using the [Clean.Architecture.Solution.Template](https://github.com/jasontaylordev/CleanArchitecture) version 8.0.0-preview.6.11.

## Build

Expand Down Expand Up @@ -38,7 +38,7 @@ dotnet new ca-usecase -n GetTodos -fn TodoLists -ut query -rt TodosVm
If you encounter the error *"No templates or subcommands found matching: 'ca-usecase'."*, install the template and try again:

```bash
dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.6.10
dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.6.11
```

## Test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you find this project useful, please give it a star. Thanks! ⭐

The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Clean.Architecture.Solution.Template):
```
dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.6.10
dotnet new install Clean.Architecture.Solution.Template::8.0.0-preview.6.11
```

Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the `-cf` or `--client-framework` option, and provide the output directory where your project will be created. Here are some examples:
Expand Down