-
-
Notifications
You must be signed in to change notification settings - Fork 378
Expand file tree
/
Copy pathGenerateDocs.ps1
More file actions
127 lines (100 loc) · 3.81 KB
/
GenerateDocs.ps1
File metadata and controls
127 lines (100 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Generates documentation by running the MigrationTools.ConsoleDataGenerator application.
.DESCRIPTION
This script runs the MigrationTools.ConsoleDataGenerator to generate YAML data files
and JSON schemas by reflecting over the migration tools' types and options.
The generated files are placed in:
- YAML data: docs/data/classes/
- JSON schemas: docs/data/schemas/
- JSON schemas: docs/data/classes/
.PARAMETER Configuration
The build configuration to use (Debug or Release). Default is Debug.
.EXAMPLE
.\GenerateDocs.ps1
Runs the documentation generator with default settings.
.EXAMPLE
.\GenerateDocs.ps1 -Configuration Release
Runs the documentation generator using Release configuration.
.EXAMPLE
.\GenerateDocs.ps1 -Verbose
Runs the documentation generator with verbose output.
#>
[CmdletBinding()]
param(
[Parameter()]
[ValidateSet("Debug", "Release")]
[string]$Configuration = "Debug"
)
# Set error action preference
$ErrorActionPreference = "Stop"
# Get the script directory (repository root)
$RepoRoot = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ProjectPath = Join-Path $RepoRoot "src" "MigrationTools.ConsoleDataGenerator"
Write-Host "🚀 Azure DevOps Migration Tools - Documentation Generator" -ForegroundColor Cyan
Write-Host "Repository Root: $RepoRoot" -ForegroundColor Gray
Write-Host "Project Path: $ProjectPath" -ForegroundColor Gray
Write-Host ""
# Verify the project exists
if (-not (Test-Path $ProjectPath)) {
Write-Error "❌ Project not found at: $ProjectPath"
exit 1
}
# Change to project directory
Push-Location $ProjectPath
try {
Write-Host "📦 Building MigrationTools.ConsoleDataGenerator..." -ForegroundColor Yellow
# Build the project
$buildArgs = @(
"build"
"--configuration", $Configuration
"--verbosity", "minimal"
)
& dotnet @buildArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "❌ Build failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "✅ Build completed successfully" -ForegroundColor Green
Write-Host ""
Write-Host "📚 Generating documentation..." -ForegroundColor Yellow
# Run the documentation generator
$runArgs = @(
"run"
"--configuration", $Configuration
"--no-build"
)
if ($VerbosePreference -eq 'Continue') {
$runArgs += "--verbosity", "detailed"
}
& dotnet @runArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "❌ Documentation generation failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "✅ Documentation generation completed successfully" -ForegroundColor Green
Write-Host ""
# Display summary of generated files
$docsDataPath = Join-Path $RepoRoot "docs" "data" "classes"
$docsSchemaPath = Join-Path $RepoRoot "docs" "static" "schema"
if (Test-Path $docsDataPath) {
$yamlFiles = Get-ChildItem -Path $docsDataPath -Filter "*.yaml" -Recurse | Measure-Object
Write-Host "📄 Generated $($yamlFiles.Count) YAML data files in docs/data/classes/" -ForegroundColor Green
}
if (Test-Path $docsSchemaPath) {
$schemaFiles = Get-ChildItem -Path $docsSchemaPath -Filter "*.json" -Recurse | Measure-Object
Write-Host "📋 Generated $($schemaFiles.Count) JSON schema files in docs/static/schema/" -ForegroundColor Green
}
Write-Host ""
Write-Host "🎉 Documentation generation completed!" -ForegroundColor Cyan
Write-Host "Generated YAML files and JSON schemas are ready for use in the documentation site." -ForegroundColor Gray
}
catch {
Write-Error "❌ An error occurred: $($_.Exception.Message)"
exit 1
}
finally {
# Return to original directory
Pop-Location
}