Skip to content

Commit 74791fe

Browse files
committed
add packages
1 parent 4712fe5 commit 74791fe

40 files changed

Lines changed: 435 additions & 1685 deletions

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
uses: actions/checkout@v5
3333
with:
3434
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35+
submodules: 'recursive' # Fetch lime-packages and network-profiles
3536
- uses: pnpm/action-setup@v4 # Uncomment this block if you're using pnpm
3637
with:
3738
version: 9 # Not needed if you've set "packageManager" in package.json
@@ -45,6 +46,8 @@ jobs:
4546
uses: actions/configure-pages@v4
4647
- name: Install dependencies
4748
run: pnpm install # or pnpm install / yarn install / bun install
49+
- name: Prebuild with VitePress
50+
run: pnpm run prebuild # or pnpm docs:build / yarn docs:build / bun run docs:build
4851
- name: Build with VitePress
4952
run: pnpm run build # or pnpm docs:build / yarn docs:build / bun run docs:build
5053
- name: Upload artifact

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ dist
33
temp
44

55
node_modules/
6+
/docs/packages/**
7+
!/docs/packages/index.md
8+
9+
/lime-packages
10+
/network-profiles

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "lime-packages"]
2+
path = lime-packages
3+
url = https://github.com/libremesh/lime-packages
4+
[submodule "network-profiles"]
5+
path = network-profiles
6+
url = https://github.com/libremesh/network-profiles

docs/.vitepress/config.mts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const libremesh = {
1111
oldstable_branch_openwrt: ['19.07'],
1212
}
1313

14-
const packages = await getFiles('docs/packages/*.md'); // Path to folder
14+
const packages = await getFiles('docs/packages/*/index.md'); // Path to folder
1515

1616
// https://vitepress.dev/reference/site-config
1717
export default defineConfig({
@@ -29,6 +29,13 @@ export default defineConfig({
2929
},
3030
},
3131

32+
rewrites: {
33+
// ':page*': 'docs/:page*',
34+
// 'packages/pkg-a/src/foo.md': 'pkg-a/foo.md',
35+
// 'packages/pkg-b/src/index.md': 'pkg-b/index.md',
36+
// 'packages/pkg-b/src/bar.md': 'pkg-b/bar.md'
37+
},
38+
3239
themeConfig: {
3340
// https://vitepress.dev/reference/default-theme-config
3441
logo: { light: '/libremesh_logo.svg', dark: '/libremesh_logo.svg', alt: 'Logo' },
@@ -92,13 +99,13 @@ function sidebarGuide(): DefaultTheme.SidebarItem[] {
9299
text: 'User Guide',
93100
collapsed: false,
94101
items: [
95-
{ text: 'Connecting to the router', link: '/install/connecting' },
102+
{ text: 'Connecting to the router', link: '/guide/connecting' },
96103
{ text: 'Packages selection',
97-
link: '/install/packages-selection',
104+
link: '/guide/packages-selection',
98105
collapsed: true,
99106
items: [
100-
{ text: 'Build customization', link: '/install/packages-selection' },
101-
{ text: 'Network Profiles', link: '/install/network-profiles' }
107+
{ text: 'Build customization', link: '/guide/packages-selection' },
108+
{ text: 'Network Profiles', link: '/guide/network-profiles' }
102109
] },
103110
{ text: 'Build LibreMesh',
104111
link: '/build',
@@ -114,7 +121,7 @@ function sidebarGuide(): DefaultTheme.SidebarItem[] {
114121
text: 'Developer Guide',
115122
collapsed: false,
116123
items: [
117-
{ text: 'Run it on QEMU', link: '/install/qemu' }
124+
{ text: 'Run it on QEMU', link: '/guide/qemu' }
118125
]
119126
},
120127
{
@@ -145,8 +152,8 @@ function sidebarGuide(): DefaultTheme.SidebarItem[] {
145152
},
146153
{
147154
text: 'Packages',
148-
collapsed: false,
149-
link: '/resources',
155+
collapsed: true,
156+
link: '/packages',
150157
items: generateSidebarItems(packages),
151158
},
152159
]

docs/.vitepress/sidebar.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ export function getFiles(path: string): Promise<INavItem[]> {
1717
return new Promise((resolve, reject) => {
1818
let navigation: INavItem[] = [];
1919
const filePath = path;
20+
console.log(path)
2021
const files: string[] = glob.sync(filePath);
22+
console.log(files)
2123
files.sort();
2224
for (const file of files) {
25+
console.log(file)
2326
const fileData = fs.readFileSync(file).toString();
2427
const fm = matter(fileData);
2528

@@ -28,6 +31,8 @@ export function getFiles(path: string): Promise<INavItem[]> {
2831
title = file;
2932
}
3033

34+
console.log(title)
35+
3136
navigation.push({
3237
title,
3338
id: fm.data.id, // Custom data
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme'
3+
4+
const { Layout } = DefaultTheme
5+
</script>
6+
7+
<template>
8+
<div v-if="frontmatter.home">
9+
<h1>{{ site.title }}</h1>
10+
<p>{{ site.description }}</p>
11+
<!-- <ul>
12+
<li><a href="/markdown-examples.html">Markdown Examples</a></li>
13+
<li><a href="/api-examples.html">API Examples</a></li>
14+
</ul> -->
15+
</div>
16+
<div v-else>
17+
<a href="/">Home</a>
18+
<Content />
19+
</div>
20+
</template>

docs/.vitepress/theme/index.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@ import { h } from 'vue'
33
import type { Theme } from 'vitepress'
44
import DefaultTheme from 'vitepress/theme'
55
import './style.css'
6+
import { redirects } from './redirects'
7+
import LayoutWide from './LayoutWide.vue'
68

79
export default {
810
extends: DefaultTheme,
911
Layout: () => {
1012
return h(DefaultTheme.Layout, null, {
1113
// https://vitepress.dev/guide/extending-default-theme#layout-slots
14+
'wide': () => h(LayoutWide)
1215
})
1316
},
1417
enhanceApp({ app, router, siteData }) {
15-
// ...
18+
19+
// add layout
20+
app.component('wide', LayoutWide)
21+
22+
// preserve old links
23+
router.onBeforeRouteChange = (to: string) => {
24+
const path = to.replace(/\.html$/i, ''),
25+
toPath = redirects[path];
26+
27+
if (toPath) {
28+
setTimeout(() => { router.go(toPath); })
29+
return false;
30+
} else {
31+
return true;
32+
}
33+
}
1634
}
1735
} satisfies Theme

docs/.vitepress/theme/redirects.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// .vitepress/theme/redirects.ts
2+
3+
export const redirects = {
4+
// '/path/from': '/path/to',
5+
'/development': '/build/buildroot/debian',
6+
'/howitworks': '/what-is-libremesh',
7+
'/docs/en_quick_starting_guide': '/getting-started',
8+
'/docs/en_connecting_nodes': '/guide/connecting',
9+
}

docs/build/imagebuilder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ aside: false
44

55
<script setup>
66
import { data as openwrt } from '/openwrt.data.js'
7-
import { data as packages } from '/packages.data.js'
7+
// import { data as packages } from '/packages.data.js'
88

99
// console.log(packages)
1010
openwrt.stable_branch = openwrt.stable_version.substr(0,5)
@@ -211,7 +211,7 @@ make image \
211211

212212
### Build using Network Profiles
213213

214-
Refers to [Network Profiles](/install/network-profiles)
214+
Refers to [Network Profiles](/guide/network-profiles)
215215

216216
```sh
217217
make image \

docs/development.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)