Skip to content

Commit d996c9e

Browse files
authored
docs: recreated using VitePress (#210)
* doc: initialize VitePress documentation * docs: moved new documentation into the docs folder * docs: add favicon support * docs: update head config * docs: improve code formatting and consistency in documentation * docs: update public resources * docs: update theme and background colors in web manifest
1 parent 3832b46 commit d996c9e

Some content is hidden

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

76 files changed

+3041
-844
lines changed

.github/workflows/pages.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy Documentation to Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'docs/**'
8+
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v5
29+
with:
30+
node-version: 22
31+
cache: npm
32+
cache-dependency-path: docs/package-lock.json
33+
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v5
36+
37+
- name: Install dependencies
38+
run: |
39+
cd docs
40+
npm ci
41+
42+
- name: Build with VitePress
43+
run: |
44+
cd docs
45+
npm run build
46+
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v4
49+
with:
50+
path: docs/.vitepress/dist
51+
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
needs: build
57+
runs-on: ubuntu-latest
58+
name: Deploy
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ jobs:
105105
RELEASE_VERSION=$(grep "project.rel.dev.onvoid.webrtc\\\:webrtc-java=" release.properties | cut -d'=' -f2)
106106
echo "Extracted release version from release.properties: $RELEASE_VERSION"
107107
108-
# Update versions.js file
109-
echo "Updating versions.js with release version: $RELEASE_VERSION and development version: ${{ github.event.inputs.developmentVersion }}"
110-
sed -i "s/VERSION: '.*'/VERSION: '$RELEASE_VERSION'/g" docs/assets/versions.js
111-
sed -i "s/VERSION_SNAPSHOT: '.*'/VERSION_SNAPSHOT: '${{ github.event.inputs.developmentVersion }}'/g" docs/assets/versions.js
108+
# Update versions.ts file
109+
echo "Updating versions.ts with release version: $RELEASE_VERSION and development version: ${{ github.event.inputs.developmentVersion }}"
110+
sed -i "s/VERSION: '.*'/VERSION: '$RELEASE_VERSION'/g" docs/.vitepress/versions.ts
111+
sed -i "s/VERSION_SNAPSHOT: '.*'/VERSION_SNAPSHOT: '${{ github.event.inputs.developmentVersion }}'/g" docs/.vitepress/versions.ts
112112
113113
# Add the updated file to the existing commit
114-
git add docs/assets/versions.js
114+
git add docs/.vitepress/versions.ts
115115
git commit --amend --no-edit
116116
117117
git push

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![Maven Central](https://img.shields.io/maven-central/v/dev.onvoid.webrtc/webrtc-java?label=Maven%20Central&logo=apache-maven)](https://search.maven.org/artifact/dev.onvoid.webrtc/webrtc-java)
33

44
<p align="center">
5-
<img alt="webrtc-java" width="100px" src="https://jrtc.dev/assets/images/logo.png" />
5+
<img alt="webrtc-java" width="100px" src="https://jrtc.dev/logo.png" />
66
<h2 align="center">Connecting the Java world through WebRTC</h2>
77
</p>
88

@@ -25,10 +25,10 @@ The library provides a comprehensive set of Java classes that map to the WebRTC
2525

2626
For more detailed information, check out the documentation:
2727

28-
- [Quickstart](https://jrtc.dev/#/quickstart) - Get up and running quickly with webrtc-java
29-
- [Guides](https://jrtc.dev/#/guide/overview) - Comprehensive documentation on using the library
30-
- [Examples](https://jrtc.dev/#/examples) - Sample code demonstrating various features
31-
- [Build Notes](https://jrtc.dev/#/build) - Instructions for building the library from source
28+
- [Quickstart](https://jrtc.dev/guide/get-started) - Get up and running quickly with webrtc-java
29+
- [Guides](https://jrtc.dev/guide/) - Comprehensive documentation on using the library
30+
- [Examples](https://jrtc.dev/guide/examples) - Sample code demonstrating various features
31+
- [Build Notes](https://jrtc.dev/guide/build) - Instructions for building the library from source
3232

3333
## License
3434

docs/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vitepress/cache
2+
.vitepress/dist
3+
4+
node_modules

docs/.nojekyll

Whitespace-only changes.

docs/.vitepress/config.mts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { defineConfig } from 'vitepress'
2+
import { footer } from "./footer";
3+
import { head } from "./head";
4+
import { navbar } from "./nav";
5+
import { sidebar } from "./sidebar";
6+
import { PROJECT_VARS } from './versions'
7+
8+
export default defineConfig({
9+
title: "webrtc-java",
10+
description: "Java native interface for WebRTC",
11+
cleanUrls: true,
12+
13+
head: head,
14+
15+
themeConfig: {
16+
logo: {
17+
light: '/logo.png',
18+
dark: '/logo.png',
19+
alt: 'logo'
20+
},
21+
22+
externalLinkIcon: true,
23+
24+
nav: navbar,
25+
sidebar: sidebar,
26+
footer: footer,
27+
socialLinks: [
28+
{ icon: 'github', link: 'https://github.com/devopvoid/webrtc-java' },
29+
],
30+
search: {
31+
provider: 'local',
32+
},
33+
},
34+
35+
markdown: {
36+
config: (md) => {
37+
md.use(variableInterpolationPlugin)
38+
},
39+
},
40+
})
41+
42+
function variableInterpolationPlugin(md) {
43+
md.core.ruler.after('normalize', 'variable-interpolation', (state) => {
44+
Object.entries(PROJECT_VARS).forEach(([key, value]) => {
45+
const regex = new RegExp(`{{\\s*${key}\\s*}}`, 'g')
46+
state.src = state.src.replace(regex, value)
47+
})
48+
})
49+
}

docs/.vitepress/footer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { DefaultTheme } from "vitepress";
2+
3+
export const footer: DefaultTheme.Footer = {
4+
message: 'Released under the <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache-2.0 License</a>.',
5+
copyright: 'Copyright © 2019-present <a href="https://github.com/devopvoid" target="_blank">Alex Andres</a>',
6+
}

docs/.vitepress/head.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { HeadConfig } from "vitepress/types/shared";
2+
3+
const isProd = process.env.NODE_ENV === 'production';
4+
5+
const head: HeadConfig[] = [
6+
['link', { rel: "icon", type: "image/png", sizes: "96x96", href: "/favicon-96x96.png" }],
7+
['link', { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }],
8+
['link', { rel: "shortcut icon", href: "/favicon.ico" }],
9+
['link', { rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" }],
10+
['link', { rel: "manifest", href: "/site.webmanifest" }],
11+
['meta', { name: "apple-mobile-web-app-title", content: "JRTC" }],
12+
]
13+
14+
if (isProd) {
15+
head.push([
16+
'script',
17+
{
18+
async: '',
19+
src: 'https://eu.umami.is/script.js',
20+
'data-website-id': '126654a9-5f07-4b57-ad7e-023eda3980ff',
21+
'data-domains': 'jrtc.dev',
22+
'data-do-not-track': 'true'
23+
},
24+
])
25+
}
26+
27+
export { head }

docs/.vitepress/nav.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { DefaultTheme } from "vitepress";
2+
import { PROJECT_VARS } from './versions'
3+
4+
export const navbar: DefaultTheme.NavItem[] = [
5+
{
6+
text: 'Guide',
7+
link: '/guide/',
8+
},
9+
{
10+
text: 'Examples',
11+
link: '/guide/examples',
12+
},
13+
{
14+
text: 'Tools',
15+
link: '/tools',
16+
},
17+
{
18+
text: PROJECT_VARS.VERSION,
19+
items: [
20+
{
21+
text: 'Changelog',
22+
link: 'https://github.com/devopvoid/webrtc-java/blob/main/CHANGELOG.md'
23+
},
24+
{
25+
text: 'Build Notes',
26+
link: '/guide/build'
27+
}
28+
]
29+
}
30+
]

docs/.vitepress/sidebar.ts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { DefaultTheme } from "vitepress";
2+
3+
export const sidebar: DefaultTheme.Sidebar = {
4+
'/guide/': { base: '/guide/', items: sidebarGuide() },
5+
'/tools/': { base: '/tools/', items: sidebarTools() },
6+
}
7+
8+
function sidebarGuide(): DefaultTheme.SidebarItem[] {
9+
return [
10+
{
11+
text: 'Introduction',
12+
collapsed: false,
13+
items: [
14+
{ text: 'What is webrtc-java?', link: '/introduction' },
15+
{ text: 'Getting Started', link: '/get-started' },
16+
],
17+
},
18+
{
19+
text: 'Media Basics',
20+
collapsed: false,
21+
items: [
22+
{ text: 'Media Devices', link: '/media/media-devices' },
23+
{ text: 'Media Constraints', link: '/media/constraints' },
24+
{ text: 'Media Directionality', link: '/media/directionality' },
25+
],
26+
},
27+
{
28+
text: 'Audio',
29+
collapsed: false,
30+
items: [
31+
{ text: 'Audio Devices', link: '/audio/audio-devices' },
32+
{ text: 'Audio Processing', link: '/audio/audio-processing' },
33+
{ text: 'Custom Audio Source', link: '/audio/custom-audio-source' },
34+
{ text: 'Headless Audio', link: '/audio/headless-audio' },
35+
{ text: 'DTMF Sender', link: '/audio/dtmf-sender' },
36+
],
37+
},
38+
{
39+
text: 'Video',
40+
collapsed: false,
41+
items: [
42+
{ text: 'Camera Video', link: '/video/camera-capture' },
43+
{ text: 'Desktop Video', link: '/video/desktop-capture' },
44+
{ text: 'Custom Video Source', link: '/video/custom-video-source' },
45+
],
46+
},
47+
{
48+
text: 'Data Communication',
49+
collapsed: false,
50+
items: [
51+
{ text: 'Data Channels', link: '/data/data-channels' },
52+
],
53+
},
54+
{
55+
text: 'Networking and ICE',
56+
collapsed: false,
57+
items: [
58+
{ text: 'Port Allocator Configuration', link: '/networking/port-allocator-config' },
59+
],
60+
},
61+
{
62+
text: 'Monitoring and Debugging',
63+
collapsed: false,
64+
items: [
65+
{ text: 'RTC Stats', link: '/monitoring/rtc-stats' },
66+
{ text: 'Logging', link: '/monitoring/logging' },
67+
],
68+
},
69+
]
70+
}
71+
72+
function sidebarTools(): DefaultTheme.SidebarItem[] {
73+
return [
74+
{
75+
text: 'Audio',
76+
collapsed: false,
77+
items: [
78+
{ text: 'Audio Converter', link: '/audio/audio-converter' },
79+
{ text: 'Audio Recorder', link: '/audio/audio-recorder' },
80+
{ text: 'Audio Player', link: '/audio/audio-player' },
81+
{ text: 'Voice Activity Detector', link: '/audio/voice-activity-detector' },
82+
],
83+
},
84+
{
85+
text: 'Video',
86+
collapsed: false,
87+
items: [
88+
{ text: 'Video Buffer Converter', link: '/video/video-buffer-converter' },
89+
{ text: 'Video Capture', link: '/video/video-capturer' },
90+
],
91+
},
92+
{
93+
text: 'Desktop',
94+
collapsed: false,
95+
items: [
96+
{ text: 'Screen Capturer', link: '/desktop/screen-capturer' },
97+
{ text: 'Window Capturer ', link: '/desktop/window-capturer' },
98+
{ text: 'Power Management', link: '/desktop/power-management' },
99+
],
100+
},
101+
]
102+
}

0 commit comments

Comments
 (0)