Skip to content

Commit 959750b

Browse files
feat: Add VitePress documentation site and improve Demo UI
1 parent c845388 commit 959750b

35 files changed

+6202
-148
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ main ]
66
paths:
77
- 'src/**'
8+
- 'docs-site/**'
89
- '.github/workflows/deploy-pages.yml'
910
workflow_dispatch:
1011

@@ -20,28 +21,46 @@ concurrency:
2021
env:
2122
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
2223
DOTNET_NOLOGO: true
24+
NODE_VERSION: '20'
2325

2426
jobs:
2527
build:
26-
name: 🏗️ Build Blazor WASM
28+
name: 🏗️ Build Demo & Docs
2729
runs-on: ubuntu-latest
2830

2931
steps:
32+
# ═══════════════════════════════════════════════════════════════════════
33+
# 📥 Checkout
34+
# ═══════════════════════════════════════════════════════════════════════
3035
- name: 📥 Checkout
3136
uses: actions/checkout@v4
3237

38+
# ═══════════════════════════════════════════════════════════════════════
39+
# 🔧 Setup .NET
40+
# ═══════════════════════════════════════════════════════════════════════
3341
- name: ⚙️ Setup .NET
3442
uses: actions/setup-dotnet@v4
3543
with:
3644
dotnet-version: 8.0.x
3745

38-
- name: 📦 Restore dependencies
46+
# ═══════════════════════════════════════════════════════════════════════
47+
# 🟢 Setup Node.js (for VitePress)
48+
# ═══════════════════════════════════════════════════════════════════════
49+
- name: 🟢 Setup Node.js
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: ${{ env.NODE_VERSION }}
53+
54+
# ═══════════════════════════════════════════════════════════════════════
55+
# 🏗️ Build Blazor Demo
56+
# ═══════════════════════════════════════════════════════════════════════
57+
- name: 📦 Restore .NET dependencies
3958
run: dotnet restore JsonViewer.Blazor.sln
4059

41-
- name: 🏗️ Build
60+
- name: 🏗️ Build Blazor Solution
4261
run: dotnet build JsonViewer.Blazor.sln --configuration Release --no-restore
4362

44-
- name: 📦 Publish Blazor WASM
63+
- name: 📦 Publish Blazor Demo
4564
run: |
4665
dotnet publish src/Blazor.Demo/Blazor.Demo.csproj \
4766
-c Release \
@@ -52,8 +71,32 @@ jobs:
5271
run: |
5372
sed -i 's|<base href="/" />|<base href="/Blazor/" />|g' release/wwwroot/index.html
5473
echo "✅ Base href updated to /Blazor/"
55-
grep "<base" release/wwwroot/index.html
5674
75+
# ═══════════════════════════════════════════════════════════════════════
76+
# 📚 Build VitePress Documentation
77+
# ═══════════════════════════════════════════════════════════════════════
78+
- name: 📦 Install VitePress dependencies
79+
working-directory: docs-site
80+
run: npm ci || npm install
81+
82+
- name: 📋 Copy logo to docs public folder
83+
run: |
84+
mkdir -p docs-site/public
85+
cp Documents/assets/logo.png docs-site/public/logo.png || echo "Logo not found, skipping"
86+
87+
- name: 🏗️ Build VitePress
88+
working-directory: docs-site
89+
run: npm run docs:build
90+
91+
- name: 📁 Copy docs to release folder
92+
run: |
93+
mkdir -p release/wwwroot/docs
94+
cp -r docs-site/.vitepress/dist/* release/wwwroot/docs/
95+
echo "✅ Documentation copied to /docs/"
96+
97+
# ═══════════════════════════════════════════════════════════════════════
98+
# 📝 Final Setup
99+
# ═══════════════════════════════════════════════════════════════════════
57100
- name: 📝 Add .nojekyll file
58101
run: touch release/wwwroot/.nojekyll
59102

@@ -64,7 +107,13 @@ jobs:
64107
run: |
65108
echo "📂 Contents of release/wwwroot:"
66109
ls -la release/wwwroot/
110+
echo ""
111+
echo "📂 Contents of release/wwwroot/docs:"
112+
ls -la release/wwwroot/docs/ || echo "No docs folder"
67113
114+
# ═══════════════════════════════════════════════════════════════════════
115+
# 📤 Upload & Deploy
116+
# ═══════════════════════════════════════════════════════════════════════
68117
- name: ⚙️ Setup Pages
69118
uses: actions/configure-pages@v5
70119

@@ -86,3 +135,13 @@ jobs:
86135
- name: 🌐 Deploy to GitHub Pages
87136
id: deployment
88137
uses: actions/deploy-pages@v4
138+
139+
- name: 📝 Create Summary
140+
run: |
141+
echo "## 🚀 Deployment Complete!" >> $GITHUB_STEP_SUMMARY
142+
echo "" >> $GITHUB_STEP_SUMMARY
143+
echo "### 🔗 Links" >> $GITHUB_STEP_SUMMARY
144+
echo "| Site | URL |" >> $GITHUB_STEP_SUMMARY
145+
echo "|------|-----|" >> $GITHUB_STEP_SUMMARY
146+
echo "| **Live Demo** | https://jsonviewer-component.github.io/Blazor/ |" >> $GITHUB_STEP_SUMMARY
147+
echo "| **Documentation** | https://jsonviewer-component.github.io/Blazor/docs/ |" >> $GITHUB_STEP_SUMMARY

docs-site/.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
.vitepress/dist/
6+
.vitepress/cache/
7+
8+
# Logs
9+
*.log
10+
npm-debug.log*
11+
12+
# OS files
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Editor directories
17+
.idea/
18+
.vscode/
19+
*.swp
20+
*.swo
21+
22+
# Environment files
23+
.env
24+
.env.local
25+
.env.*.local
26+

docs-site/.vitepress/config.ts

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
export default defineConfig({
4+
title: "JsonViewer.Blazor",
5+
description: "A powerful JSON viewer component for Blazor applications",
6+
7+
head: [
8+
['link', { rel: 'icon', type: 'image/png', href: '/logo.png' }],
9+
['meta', { name: 'theme-color', content: '#6366f1' }],
10+
['meta', { name: 'og:type', content: 'website' }],
11+
['meta', { name: 'og:title', content: 'JsonViewer.Blazor Documentation' }],
12+
['meta', { name: 'og:description', content: 'A powerful JSON viewer component for Blazor' }],
13+
['meta', { name: 'og:image', content: '/og-image.png' }],
14+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
15+
],
16+
17+
base: '/Blazor/docs/',
18+
outDir: './.vitepress/dist',
19+
20+
cleanUrls: true,
21+
22+
themeConfig: {
23+
logo: '/logo.png',
24+
25+
nav: [
26+
{ text: '🏠 Home', link: '/' },
27+
{ text: '📚 Guide', link: '/guide/getting-started' },
28+
{ text: '🎨 Examples', link: '/examples/basic' },
29+
{ text: '📖 API', link: '/api/components' },
30+
{
31+
text: '🔗 Links',
32+
items: [
33+
{ text: '📦 NuGet', link: 'https://www.nuget.org/packages/JsonViewer.Blazor' },
34+
{ text: '🐙 GitHub', link: 'https://github.com/JsonViewer-Component/Blazor' },
35+
{ text: '🚀 Live Demo', link: 'https://jsonviewer-component.github.io/Blazor/' },
36+
{ text: '📝 Changelog', link: '/changelog' }
37+
]
38+
}
39+
],
40+
41+
sidebar: {
42+
'/guide/': [
43+
{
44+
text: '🚀 Getting Started',
45+
items: [
46+
{ text: 'Introduction', link: '/guide/introduction' },
47+
{ text: 'Installation', link: '/guide/installation' },
48+
{ text: 'Quick Start', link: '/guide/getting-started' }
49+
]
50+
},
51+
{
52+
text: '⚙️ Configuration',
53+
items: [
54+
{ text: 'Basic Setup', link: '/guide/configuration' },
55+
{ text: 'Themes', link: '/guide/themes' },
56+
{ text: 'Customization', link: '/guide/customization' }
57+
]
58+
},
59+
{
60+
text: '🎯 Features',
61+
items: [
62+
{ text: 'Search', link: '/guide/features/search' },
63+
{ text: 'Statistics', link: '/guide/features/statistics' },
64+
{ text: 'Export', link: '/guide/features/export' },
65+
{ text: 'Edit Mode', link: '/guide/features/edit-mode' }
66+
]
67+
}
68+
],
69+
'/examples/': [
70+
{
71+
text: '📝 Examples',
72+
items: [
73+
{ text: 'Basic Usage', link: '/examples/basic' },
74+
{ text: 'Read-Only Mode', link: '/examples/readonly' },
75+
{ text: 'Editable Mode', link: '/examples/editable' },
76+
{ text: 'Dynamic Loading', link: '/examples/dynamic' },
77+
{ text: 'Large JSON Files', link: '/examples/large-files' },
78+
{ text: 'Custom Styling', link: '/examples/custom-styling' }
79+
]
80+
}
81+
],
82+
'/api/': [
83+
{
84+
text: '📖 API Reference',
85+
items: [
86+
{ text: 'Components', link: '/api/components' },
87+
{ text: 'Parameters', link: '/api/parameters' },
88+
{ text: 'Events', link: '/api/events' },
89+
{ text: 'Methods', link: '/api/methods' }
90+
]
91+
}
92+
]
93+
},
94+
95+
socialLinks: [
96+
{ icon: 'github', link: 'https://github.com/JsonViewer-Component/Blazor' },
97+
{ icon: 'twitter', link: 'https://twitter.com/jsonviewerblazor' }
98+
],
99+
100+
footer: {
101+
message: 'Released under the MIT License.',
102+
copyright: '© 2025 Parsa Panahpoor. All rights reserved.'
103+
},
104+
105+
search: {
106+
provider: 'local',
107+
options: {
108+
translations: {
109+
button: {
110+
buttonText: 'Search...',
111+
buttonAriaLabel: 'Search documentation'
112+
},
113+
modal: {
114+
noResultsText: 'No results found',
115+
resetButtonTitle: 'Reset search',
116+
footer: {
117+
selectText: 'to select',
118+
navigateText: 'to navigate'
119+
}
120+
}
121+
}
122+
}
123+
},
124+
125+
editLink: {
126+
pattern: 'https://github.com/JsonViewer-Component/Blazor/edit/main/docs-site/:path',
127+
text: 'Edit this page on GitHub'
128+
},
129+
130+
lastUpdated: {
131+
text: 'Last updated',
132+
formatOptions: {
133+
dateStyle: 'medium',
134+
timeStyle: 'short'
135+
}
136+
},
137+
138+
outline: {
139+
level: [2, 3],
140+
label: 'On this page'
141+
}
142+
},
143+
144+
markdown: {
145+
theme: {
146+
light: 'github-light',
147+
dark: 'github-dark'
148+
},
149+
lineNumbers: true
150+
}
151+
})
152+

0 commit comments

Comments
 (0)