Skip to content

Commit 6688dd4

Browse files
committed
ReqnrollFormatters.CustomizedHtml: Add example for a complete custom template
1 parent ba849af commit 6688dd4

15 files changed

+10704
-5
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,7 @@ ASALocalRun/
330330
.mfractor/
331331
*.feature.cs
332332
*.feature.vb
333+
334+
# Reqnroll Formatters
335+
/ReqnrollFormatters/ReqnrollFormatters.CustomizedHtml/CustomTemplate/dist/
336+
/ReqnrollFormatters/ReqnrollFormatters.CustomizedHtml/Resources/
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Build-TemplateFormatter.ps1
2+
param (
3+
[switch]$Watch
4+
)
5+
6+
$ErrorActionPreference = "Stop"
7+
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
8+
$customTemplatePath = Join-Path $scriptPath "CustomTemplate"
9+
10+
Write-Host "Script path: $scriptPath"
11+
Write-Host "CustomTemplate path: $customTemplatePath"
12+
13+
# Navigate to the CustomTemplate directory
14+
Push-Location $customTemplatePath
15+
16+
try {
17+
# Install dependencies if node_modules doesn't exist
18+
if (-not (Test-Path "node_modules")) {
19+
Write-Host "Installing npm dependencies..."
20+
npm install --no-fund --no-audit --legacy-peer-deps
21+
22+
if ($LASTEXITCODE -ne 0) {
23+
Write-Warning "npm install failed with exit code $LASTEXITCODE"
24+
# Continue anyway - we have fallback resources
25+
}
26+
}
27+
else {
28+
Write-Host "node_modules directory already exists, skipping npm install"
29+
}
30+
31+
# Build the project
32+
if ($Watch) {
33+
Write-Host "Starting webpack in watch mode..."
34+
npm run watch
35+
} else {
36+
Write-Host "Building project..."
37+
npm run build
38+
39+
if ($LASTEXITCODE -ne 0) {
40+
Write-Warning "npm run build failed with exit code $LASTEXITCODE"
41+
}
42+
}
43+
44+
# Check if the dist directory was created successfully
45+
if (Test-Path "dist") {
46+
Write-Host "Build completed successfully. Resources are embedded directly from their source locations."
47+
}
48+
else {
49+
Write-Warning "The dist directory wasn't created. The project may not compile correctly."
50+
}
51+
52+
} catch {
53+
Write-Error "An error occurred: $_"
54+
} finally {
55+
# Return to the original directory
56+
Pop-Location
57+
}
58+
59+
Write-Host "Build process completed."

0 commit comments

Comments
 (0)