-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocfx-utils.ps1
62 lines (53 loc) · 2.37 KB
/
docfx-utils.ps1
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
[CmdletBinding(PositionalBinding=$false)]
param
(
[parameter(mandatory=$false)][switch][Alias("c")]$clean,
[parameter(mandatory=$false)][switch][Alias("b")]$build,
[parameter(mandatory=$false)][switch][Alias("d")]$doclinkchecker,
[parameter(mandatory=$false)][string][Alias("l")]$lychee,
[parameter(mandatory=$false)][string][Alias("a")]$all
)
# this is called removeartifacts instead of clean because clean might be already mean something in powershell?
function removeartifacts
{
$deletePaths = ".\workflows\**\*.svg", ".\workflows\hardware\**\*.svg", ".\workflows\**\*.bonsai.layout", ".\workflows\hardware\**\*.bonsai.layout", ".\api\*.yml", ".\api\.manifest", ".\_site\", ".\_raw\", ".\_view\", ".\src\onix-bonsai-onix1\artifacts\"
foreach($deletePath in $deletePaths){if (Test-Path $deletePath){Remove-Item $deletePath -Recurse}}
Write-Output ""
}
function build{.\build.ps1 --logLevel Suggestion --warningsAsErrors}
function lychee($lycheePath)
{
Write-Output "`nRunning lychee..."
Write-Output "------------------------------------------`n"
Invoke-Expression "& `"$lycheePath`" --no-progress --base _site --exclude ^https://github\.com.*merge.* --exclude ^https://github\.com.*apiSpec.* --exclude ^https://github\.com/open-ephys/onix1-bonsai-docs/blob/.*/#L1 '_site/**/*.html'"
Write-Output "`n"
}
function doclinkchecker
{
Write-Output "`nRunning DocLinkChecker..."
Write-Output "------------------------------------------`n"
dotnet DocLinkChecker -v -f .github/workflows/DocLinkChecker.config
}
if ($clean){removeartifacts}
if ($build){build}
if ($doclinkchecker){doclinkchecker}
if ($PSBoundParameters.ContainsKey("lychee")){lychee $lychee}
if ($PSBoundParameters.ContainsKey("all"))
{
Write-Output "`n------------------------------------------"
Write-Output "Cleaning artifacts..."
Write-Output "------------------------------------------"
removeartifacts
Write-Output "------------------------------------------"
Write-Output "Exporting SVGs & building docs..."
Write-Output "------------------------------------------`n"
Start-Sleep -Seconds 2
build
Write-Output "`------------------------------------------"
Write-Output "Running linkchecks..."
Write-Output "------------------------------------------"
Start-Sleep -Seconds 2
doclinkchecker
Start-Sleep -Seconds 2
lychee $all
}