Skip to content

Commit 4ce4113

Browse files
Merge pull request #136 from wieslawsoltes/docs/lunet-site-panandzoom
Add Lunet Documentation Site for PanAndZoom
2 parents 061d399 + 874759c commit 4ce4113

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+23744
-0
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"lunet": {
6+
"version": "1.0.10",
7+
"commands": [
8+
"lunet"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.github/workflows/docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup .NET SDKs
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: |
22+
10.0.x
23+
8.0.x
24+
25+
- name: Restore local tools
26+
run: dotnet tool restore
27+
28+
- name: Build docs
29+
run: |
30+
chmod +x build-docs.sh
31+
./build-docs.sh
32+
33+
- name: Deploy to GitHub Pages
34+
uses: peaceiris/actions-gh-pages@v4
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./site/.lunet/build/www

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,6 @@ tools/**
289289

290290
# macOS
291291
.DS_Store
292+
293+
# Documentation output
294+
/site/.lunet/build/

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ You can install the package for `Avalonia` based projects like this:
3333
## Resources
3434

3535
* [GitHub source code repository.](https://github.com/wieslawsoltes/PanAndZoom)
36+
* [Documentation site.](https://wieslawsoltes.github.io/PanAndZoom)
37+
* [Articles home.](site/articles/readme.md)
38+
* [Headless testing docs.](site/articles/headless-testing/readme.md)
3639

3740
## Using PanAndZoom
3841

@@ -699,6 +702,33 @@ zoomBorder.ImportState(restoredState);
699702
- Implement undo/redo functionality
700703
- Session state management
701704

705+
## Documentation
706+
707+
The repository now includes a Lunet-based documentation site, modeled after the TreeDataGrid docs pipeline and tailored to `PanAndZoom` and `HeadlessTestingFramework`.
708+
709+
Key entry points:
710+
711+
- [Docs home](site/readme.md)
712+
- [Getting Started](site/articles/getting-started/readme.md)
713+
- [Headless Testing](site/articles/headless-testing/readme.md)
714+
- [Reference](site/articles/reference/readme.md)
715+
716+
Build docs locally:
717+
718+
```bash
719+
./build-docs.sh
720+
./serve-docs.sh
721+
```
722+
723+
PowerShell:
724+
725+
```powershell
726+
./build-docs.ps1
727+
./serve-docs.ps1
728+
```
729+
730+
Generated output is written to `site/.lunet/build/www`.
731+
702732
## License
703733

704734
PanAndZoom is licensed under the [MIT license](LICENSE.TXT).

build-docs.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
dotnet tool restore
4+
Push-Location site
5+
try {
6+
dotnet tool run lunet --stacktrace build
7+
}
8+
finally {
9+
Pop-Location
10+
}

build-docs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
dotnet tool restore
5+
cd site
6+
dotnet tool run lunet --stacktrace build

check-docs.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
dotnet tool restore
5+
cd site
6+
dotnet tool run lunet --stacktrace build

serve-docs.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$hostAddress = if ($env:DOCS_HOST) { $env:DOCS_HOST } else { '127.0.0.1' }
4+
$port = if ($env:DOCS_PORT) { $env:DOCS_PORT } else { '8080' }
5+
6+
dotnet tool restore
7+
Push-Location site
8+
try {
9+
if (Get-Command python3 -ErrorAction SilentlyContinue) {
10+
$pythonCommand = 'python3'
11+
$pythonArgs = @('-m', 'http.server', $port, '--bind', $hostAddress)
12+
} elseif (Get-Command python -ErrorAction SilentlyContinue) {
13+
$pythonCommand = 'python'
14+
$pythonArgs = @('-m', 'http.server', $port, '--bind', $hostAddress)
15+
} elseif (Get-Command py -ErrorAction SilentlyContinue) {
16+
$pythonCommand = 'py'
17+
$pythonArgs = @('-3', '-m', 'http.server', $port, '--bind', $hostAddress)
18+
} else {
19+
Write-Warning "Python runtime not found (python3/python/py). Falling back to 'lunet serve'."
20+
dotnet tool run lunet --stacktrace serve
21+
return
22+
}
23+
24+
dotnet tool run lunet --stacktrace build --dev
25+
26+
$watcher = Start-Process -FilePath 'dotnet' `
27+
-ArgumentList @('tool', 'run', 'lunet', '--stacktrace', 'build', '--dev', '--watch') `
28+
-NoNewWindow `
29+
-PassThru
30+
31+
try {
32+
Write-Host "Serving docs at http://${hostAddress}:$port"
33+
Write-Host 'Watching docs with Lunet (dev mode)...'
34+
35+
Push-Location '.lunet/build/www'
36+
try {
37+
& $pythonCommand @pythonArgs
38+
}
39+
finally {
40+
Pop-Location
41+
}
42+
}
43+
finally {
44+
if ($watcher -and -not $watcher.HasExited) {
45+
Stop-Process -Id $watcher.Id -Force
46+
}
47+
}
48+
}
49+
finally {
50+
Pop-Location
51+
}

serve-docs.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
HOST="${DOCS_HOST:-127.0.0.1}"
5+
PORT="${DOCS_PORT:-8080}"
6+
7+
dotnet tool restore
8+
cd site
9+
10+
if command -v python3 >/dev/null 2>&1; then
11+
PYTHON_BIN="python3"
12+
elif command -v python >/dev/null 2>&1; then
13+
PYTHON_BIN="python"
14+
else
15+
echo "Python runtime not found (python3/python). Falling back to 'lunet serve'." >&2
16+
dotnet tool run lunet --stacktrace serve
17+
exit 0
18+
fi
19+
20+
dotnet tool run lunet --stacktrace build --dev
21+
22+
dotnet tool run lunet --stacktrace build --dev --watch &
23+
LUNET_WATCH_PID=$!
24+
25+
cleanup() {
26+
kill "${LUNET_WATCH_PID}" >/dev/null 2>&1 || true
27+
}
28+
29+
trap cleanup EXIT INT TERM
30+
31+
echo "Serving docs at http://${HOST}:${PORT}"
32+
echo "Watching docs with Lunet (dev mode)..."
33+
34+
cd .lunet/build/www
35+
"${PYTHON_BIN}" -m http.server "${PORT}" --bind "${HOST}"

0 commit comments

Comments
 (0)