Skip to content

Commit b6aba38

Browse files
cjshacjsha
andauthored
Exclude certain URLs for local linkchecks (#109)
* Exclude certain URLs for local linkchecks - branched github URLs being checked even though they don't exist until pushed. Those URLs are now optionally checked with the -r flag - "linkcheck" -> "lychee" to distinguish the function that runs lychee linkchecks and the function that runs doclinkchecker linkchecks * call lychee instead of linkchec when utils are run w/ -a flag * Remove "-r" flag from utils --------- Co-authored-by: cjsha <[email protected]>
1 parent 1b858cd commit b6aba38

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

docfx-utils.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@ param
44
[parameter(mandatory=$false)][switch][Alias("c")]$clean,
55
[parameter(mandatory=$false)][switch][Alias("b")]$build,
66
[parameter(mandatory=$false)][switch][Alias("d")]$doclinkchecker,
7-
[parameter(mandatory=$false)][string][Alias("l")]$linkcheck,
7+
[parameter(mandatory=$false)][string][Alias("l")]$lychee,
88
[parameter(mandatory=$false)][string][Alias("a")]$all
99
)
1010

1111
# this is called removeartifacts instead of clean because clean might be already mean something in powershell?
1212
function removeartifacts
1313
{
1414
$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\"
15-
1615
foreach($deletePath in $deletePaths){if (Test-Path $deletePath){Remove-Item $deletePath -Recurse}}
1716
Write-Output ""
1817
}
1918

2019
function build{.\build.ps1 --logLevel Suggestion --warningsAsErrors}
2120

22-
function linkcheck
21+
function lychee($lycheePath)
2322
{
24-
param($lycheePath)
2523
Write-Output "`nRunning lychee..."
2624
Write-Output "------------------------------------------`n"
27-
Invoke-Expression "& `"$lycheePath`" --no-progress --base _site --exclude ^https://github\.com.*merge.* --exclude ^https://github\.com.*apiSpec.* '_site/**/*.html'"
25+
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'"
2826
Write-Output "`n"
2927
}
3028

@@ -41,7 +39,7 @@ if ($build){build}
4139

4240
if ($doclinkchecker){doclinkchecker}
4341

44-
if ($PSBoundParameters.ContainsKey("linkcheck")){linkcheck($linkcheck)}
42+
if ($PSBoundParameters.ContainsKey("lychee")){lychee $lychee}
4543

4644
if ($PSBoundParameters.ContainsKey("all"))
4745
{
@@ -60,5 +58,5 @@ if ($PSBoundParameters.ContainsKey("all"))
6058
Start-Sleep -Seconds 2
6159
doclinkchecker
6260
Start-Sleep -Seconds 2
63-
linkcheck($all)
61+
lychee $all
6462
}

0 commit comments

Comments
 (0)