Skip to content

Commit 4720846

Browse files
committed
Fix Codex local environment setup
1 parent 945622c commit 4720846

1 file changed

Lines changed: 44 additions & 46 deletions

File tree

.codex/environments/environment.toml

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,90 +4,88 @@ name = "Exceptionless Aspire"
44

55
[setup]
66
script = '''
7-
Set-StrictMode -Version Latest
8-
$ErrorActionPreference = "Stop"
7+
set -e
98
10-
Set-Location $env:CODEX_WORKTREE_PATH
9+
cd "${CODEX_WORKTREE_PATH:?CODEX_WORKTREE_PATH is required}"
1110
12-
Write-Host "Setting up Exceptionless Aspire worktree: $env:CODEX_WORKTREE_PATH"
11+
echo "Setting up Exceptionless Aspire worktree: $CODEX_WORKTREE_PATH"
1312
14-
if (-not (Get-Command dotnet -ErrorAction SilentlyContinue)) {
15-
throw "dotnet is not installed or not on PATH. Exceptionless requires .NET 10."
16-
}
13+
if ! command -v dotnet >/dev/null 2>&1; then
14+
echo "dotnet is not installed or not on PATH. Exceptionless requires .NET 10." >&2
15+
exit 1
16+
fi
1717
18-
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
19-
throw "node is not installed or not on PATH. Exceptionless requires Node 24+."
20-
}
18+
if ! command -v node >/dev/null 2>&1; then
19+
echo "node is not installed or not on PATH. Exceptionless requires Node 24+." >&2
20+
exit 1
21+
fi
2122
22-
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
23-
throw "npm is not installed or not on PATH."
24-
}
23+
if ! command -v npm >/dev/null 2>&1; then
24+
echo "npm is not installed or not on PATH." >&2
25+
exit 1
26+
fi
2527
26-
Write-Host "dotnet:"
28+
echo "dotnet:"
2729
dotnet --version
2830
29-
Write-Host "node:"
31+
echo "node:"
3032
node --version
3133
32-
Write-Host "npm:"
34+
echo "npm:"
3335
npm --version
3436
35-
Write-Host "Restoring .NET workloads..."
37+
echo "Restoring .NET workloads..."
3638
dotnet workload restore
3739
38-
Write-Host "Restoring Exceptionless.slnx..."
39-
dotnet restore Exceptionless.slnx
40+
echo "Restoring Exceptionless.slnx..."
41+
dotnet restore Exceptionless.slnx -p:WarningsNotAsErrors=NU1903
4042
41-
Write-Host "Installing Svelte frontend dependencies..."
43+
echo "Installing Svelte frontend dependencies..."
4244
npm ci --prefix src/Exceptionless.Web/ClientApp --prefer-offline --no-audit
4345
44-
Write-Host "Installing legacy Angular frontend dependencies..."
46+
echo "Installing legacy Angular frontend dependencies..."
4547
npm ci --prefix src/Exceptionless.Web/ClientApp.angular --prefer-offline --no-audit
4648
47-
Write-Host "Setup complete. Use the Run Aspire action to start the app."
49+
echo "Setup complete. Use the Run Aspire action to start the app."
4850
'''
4951

5052
[cleanup]
5153
script = '''
52-
Set-StrictMode -Version Latest
53-
$ErrorActionPreference = "Continue"
54+
set +e
5455
55-
Set-Location $env:CODEX_WORKTREE_PATH
56+
cd "${CODEX_WORKTREE_PATH:?CODEX_WORKTREE_PATH is required}"
5657
57-
Write-Host "Cleaning Exceptionless worktree-local output only: $env:CODEX_WORKTREE_PATH"
58+
echo "Cleaning Exceptionless worktree-local output only: $CODEX_WORKTREE_PATH"
5859
59-
Write-Host "Removing repo-local temp/test output only..."
60+
echo "Removing repo-local temp/test output only..."
6061
61-
Remove-Item -Recurse -Force .cache/tmp -ErrorAction SilentlyContinue
62-
Remove-Item -Recurse -Force .aspire -ErrorAction SilentlyContinue
63-
Remove-Item -Recurse -Force TestResults -ErrorAction SilentlyContinue
62+
rm -rf .cache/tmp
63+
rm -rf .aspire
64+
rm -rf TestResults
6465
65-
Get-ChildItem -Recurse -Directory -Force -ErrorAction SilentlyContinue |
66-
Where-Object { $_.Name -in @("TestResults", ".vite", ".svelte-kit") } |
67-
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
66+
find . -type d \( -name TestResults -o -name .vite -o -name .svelte-kit \) -exec rm -rf {} +
6867
69-
Write-Host "Cleanup complete."
70-
Write-Host "Aspire infrastructure containers and Docker volumes were intentionally left alone."
68+
echo "Cleanup complete."
69+
echo "Aspire infrastructure containers and Docker volumes were intentionally left alone."
7170
'''
7271

7372
[[actions]]
7473
name = "Run Aspire"
7574
icon = "run"
7675
command = '''
77-
Set-StrictMode -Version Latest
78-
$ErrorActionPreference = "Stop"
76+
set -e
7977
80-
Set-Location $env:CODEX_WORKTREE_PATH
78+
cd "${CODEX_WORKTREE_PATH:?CODEX_WORKTREE_PATH is required}"
8179
82-
$env:AppMode = "Development"
83-
$env:DOTNET_ENVIRONMENT = "Development"
84-
$env:ASPNETCORE_ENVIRONMENT = "Development"
80+
export AppMode=Development
81+
export DOTNET_ENVIRONMENT=Development
82+
export ASPNETCORE_ENVIRONMENT=Development
8583
86-
if (Get-Command aspire -ErrorAction SilentlyContinue) {
87-
aspire run
88-
} else {
89-
dotnet run --project src/Exceptionless.AppHost/Exceptionless.AppHost.csproj
90-
}
84+
if command -v aspire >/dev/null 2>&1; then
85+
aspire run
86+
else
87+
dotnet run --project src/Exceptionless.AppHost/Exceptionless.AppHost.csproj
88+
fi
9189
'''
9290

9391
[[actions]]

0 commit comments

Comments
 (0)