Skip to content

Commit 99553ff

Browse files
committed
Add local dev run script
1 parent 701ebdf commit 99553ff

2 files changed

Lines changed: 90 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ Release artifact build:
146146
.\scripts\build-release.ps1 -Configuration Release -Version 0.1.0
147147
```
148148

149+
Local development helper:
150+
151+
```powershell
152+
.\scripts\run-dev.ps1
153+
.\scripts\run-dev.ps1 -Mode test
154+
.\scripts\run-dev.ps1 -Mode cli -CliArgs @("test", "critical")
155+
.\scripts\run-dev.ps1 -Mode release -Version 0.1.0
156+
```
157+
149158
## Build From Source
150159

151160
Requirements:

scripts/run-dev.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
param(
2+
[ValidateSet("app", "cli", "build", "test", "release")]
3+
[string]$Mode = "app",
4+
5+
[string[]]$CliArgs = @(),
6+
7+
[string]$Configuration = "Debug",
8+
9+
[string]$Version = "0.1.0",
10+
11+
[switch]$NoRestore,
12+
13+
[switch]$NoBuild
14+
)
15+
16+
$ErrorActionPreference = "Stop"
17+
18+
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
19+
20+
function Invoke-Checked {
21+
param(
22+
[Parameter(Mandatory = $true)]
23+
[scriptblock]$Command
24+
)
25+
26+
& $Command
27+
if ($LASTEXITCODE -ne 0) {
28+
throw "Command failed with exit code $LASTEXITCODE"
29+
}
30+
}
31+
32+
Push-Location $repoRoot
33+
try {
34+
if (-not $NoRestore) {
35+
Invoke-Checked { dotnet restore ToastDeck.slnx }
36+
}
37+
38+
switch ($Mode) {
39+
"app" {
40+
if (-not $NoBuild) {
41+
Invoke-Checked { dotnet build ToastDeck.slnx --configuration $Configuration --no-restore }
42+
}
43+
44+
Invoke-Checked {
45+
dotnet run `
46+
--project src\ToastDeck.App\ToastDeck.App.csproj `
47+
--framework net10.0-windows10.0.19041.0 `
48+
--configuration $Configuration `
49+
--no-build
50+
}
51+
}
52+
53+
"cli" {
54+
Invoke-Checked {
55+
dotnet run `
56+
--project src\ToastDeck.Cli\ToastDeck.Cli.csproj `
57+
--configuration $Configuration `
58+
-- @CliArgs
59+
}
60+
}
61+
62+
"build" {
63+
Invoke-Checked { dotnet build ToastDeck.slnx --configuration $Configuration --no-restore }
64+
}
65+
66+
"test" {
67+
if (-not $NoBuild) {
68+
Invoke-Checked { dotnet build ToastDeck.slnx --configuration $Configuration --no-restore }
69+
}
70+
71+
Invoke-Checked { dotnet test ToastDeck.slnx --configuration $Configuration --no-build }
72+
}
73+
74+
"release" {
75+
Invoke-Checked { .\scripts\build-release.ps1 -Configuration Release -Version $Version }
76+
}
77+
}
78+
}
79+
finally {
80+
Pop-Location
81+
}

0 commit comments

Comments
 (0)