Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude certain URLs for local linkchecks #109

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docfx-utils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@ 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")]$linkcheck,
[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 linkcheck
function lychee($lycheePath)
{
param($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.* '_site/**/*.html'"
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"
}

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

if ($doclinkchecker){doclinkchecker}

if ($PSBoundParameters.ContainsKey("linkcheck")){linkcheck($linkcheck)}
if ($PSBoundParameters.ContainsKey("lychee")){lychee $lychee}

if ($PSBoundParameters.ContainsKey("all"))
{
Expand All @@ -60,5 +58,5 @@ if ($PSBoundParameters.ContainsKey("all"))
Start-Sleep -Seconds 2
doclinkchecker
Start-Sleep -Seconds 2
linkcheck($all)
lychee $all
}
Loading