Skip to content

Commit 1dc6a55

Browse files
committed
chore: move to vitepress
1 parent 2792edf commit 1dc6a55

542 files changed

Lines changed: 112663 additions & 56442 deletions

File tree

Some content is hidden

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

.eslintrc.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'github-actions'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
- uses: pnpm/action-setup@v5
19+
- name: Use Node.js
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version: 22
23+
cache: 'pnpm'
24+
- run: pnpm install --frozen-lockfile
25+
- run: pnpm test

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ typings/
6868
# nuxt.js build output
6969
.nuxt
7070

71-
# Nuxt generate
71+
# Build output
7272
dist
7373

74-
# vuepress build output
75-
.vuepress/dist
74+
# vitepress build output
75+
dist
76+
.vitepress/cache
7677

7778
# Serverless directories
7879
.serverless

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.14.0
1+
24.14.1

.oxfmtrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
3+
"singleQuote": true,
4+
"printWidth": 120,
5+
"sortPackageJson": false,
6+
"sortImports": {
7+
"groups": [
8+
"builtin",
9+
"external",
10+
["internal", "parent", "sibling", "index"],
11+
"type-builtin",
12+
"type-external",
13+
["type-internal", "type-parent", "type-sibling", "type-index"]
14+
]
15+
},
16+
"ignorePatterns": [],
17+
"overrides": [
18+
{
19+
"files": ["generated/**"],
20+
"options": {
21+
"printWidth": 80
22+
}
23+
}
24+
]
25+
}

.oxlintrc.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["typescript", "unicorn", "vue"],
4+
"env": {
5+
"node": true,
6+
"browser": true
7+
},
8+
"categories": {
9+
"correctness": "error",
10+
"perf": "error",
11+
"suspicious": "error",
12+
"pedantic": "warn",
13+
"style": "warn",
14+
"nursery": "warn"
15+
},
16+
"globals": {
17+
"defineProps": "readonly",
18+
"defineModel": "readonly"
19+
},
20+
"rules": {
21+
"id-length": "off",
22+
"init-declarations": "off",
23+
"max-depth": "off",
24+
"max-lines-per-function": "off",
25+
"max-params": "off",
26+
"max-statements": "off",
27+
"no-await-in-loop": "off",
28+
"no-duplicate-imports": ["error", { "allowSeparateTypeImports": true }],
29+
"no-magic-numbers": "off",
30+
"no-ternary": "off",
31+
"prefer-global-this": "off",
32+
"sort-imports": "off",
33+
"typescript/consistent-type-imports": ["error", { "prefer": "type-imports", "fixStyle": "separate-type-imports" }],
34+
"unicorn/filename-case": "off",
35+
"unicorn/no-null": "off",
36+
"unicorn/prefer-node-protocol": "error"
37+
}
38+
}

.vitepress/config.ts

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
import { defineConfig } from 'vitepress';
2+
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
3+
4+
import modulesData from '../generated/metadata/modules.json' with { type: 'json' };
5+
import hapiInfo from '../generated/modules/hapi/info.json' with { type: 'json' };
6+
import pluginsData from '../src/plugins.json' with { type: 'json' };
7+
import { formatVersion } from './utils.js';
8+
9+
const modulesItems = Object.keys(modulesData)
10+
.filter((name) => name !== 'hapi')
11+
.map((name) => ({
12+
link: `/module/${name}/api/${modulesData[name as keyof typeof modulesData].latestVersion}`,
13+
text: name,
14+
}));
15+
16+
const getModuleSidebar = (moduleName: string) => {
17+
const moduleData = modulesData[moduleName as keyof typeof modulesData];
18+
19+
const items: { link: string; text: string; items?: { link: string; text: string }[] }[] = [
20+
{
21+
items: [...moduleData.versions].toReversed().map((version) => ({
22+
link: `/module/${moduleName}/api/${formatVersion(version.name)}`,
23+
text: formatVersion(version.name),
24+
})),
25+
link: `/module/${moduleName}/api/${moduleData.latestVersion}`,
26+
text: 'API',
27+
},
28+
{ link: `/module/${moduleName}/changelog`, text: 'Changelog' },
29+
];
30+
31+
if (moduleName === 'bell') {
32+
items.push({ link: '/module/bell/examples', text: 'Examples' });
33+
items.push({ link: '/module/bell/providers', text: 'Providers' });
34+
}
35+
36+
return [
37+
{
38+
items,
39+
text: moduleName,
40+
},
41+
{
42+
collapsed: true,
43+
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
44+
text: 'Other Modules',
45+
},
46+
];
47+
};
48+
49+
const moduleSidebars = Object.fromEntries(
50+
Object.keys(modulesData)
51+
.filter((name) => name !== 'hapi')
52+
.map((name) => [`/module/${name}/`, getModuleSidebar(name)]),
53+
);
54+
55+
const tutorialItems = [
56+
{ slug: 'getting-started', text: 'Getting Started' },
57+
{ slug: 'auth', text: 'Authentication' },
58+
{ slug: 'caching', text: 'Caching' },
59+
{ slug: 'cookies', text: 'Cookies' },
60+
{ slug: 'logging', text: 'Logging' },
61+
{ slug: 'plugins', text: 'Plugins' },
62+
{ slug: 'routing', text: 'Routing' },
63+
{ slug: 'server-methods', text: 'Server Methods' },
64+
{ slug: 'serving-files', text: 'Serving Files' },
65+
{ slug: 'testing', text: 'Testing' },
66+
{ slug: 'validation', text: 'Validation' },
67+
{ slug: 'views', text: 'Views' },
68+
{ slug: 'community', text: 'Community' },
69+
{ slug: 'express-to-hapi', text: 'Express to hapi' },
70+
];
71+
72+
const getTutorialSidebar = (locale: string) => [
73+
{
74+
items: tutorialItems.map((t) => ({
75+
link: `/tutorials/${locale}/${t.slug}`,
76+
text: t.text,
77+
})),
78+
text: 'Tutorials',
79+
},
80+
];
81+
82+
export default defineConfig({
83+
appearance: true,
84+
cleanUrls: true,
85+
description: 'The Simple, Secure Framework Developers Trust',
86+
head: [['link', { href: '/favicon.png', rel: 'icon', type: 'image/png' }]],
87+
ignoreDeadLinks: true,
88+
markdown: {
89+
config(md) {
90+
md.use(groupIconMdPlugin);
91+
},
92+
lineNumbers: true,
93+
theme: {
94+
dark: 'vitesse-dark',
95+
light: 'vitesse-light',
96+
},
97+
},
98+
outDir: 'dist',
99+
srcDir: 'docs',
100+
themeConfig: {
101+
docFooter: {
102+
next: false,
103+
prev: false,
104+
},
105+
footer: {
106+
copyright: 'Copyright © 2012-present hapi.js team',
107+
message:
108+
'<a href="https://www.netlify.com" target="_blank"><img src="https://www.netlify.com/assets/badges/netlify-badge-dark.svg" alt="Deploys by Netlify" style="display: inline-block; vertical-align: middle; height: 30px; margin-left: 10px;" /></a>',
109+
},
110+
logo: '/img/hapi.svg',
111+
nav: [
112+
{ link: '/', text: 'Home' },
113+
{ activeMatch: '^/api/', link: `/api/${formatVersion(hapiInfo.versions.at(-1)!.name)}`, text: 'API' },
114+
{ activeMatch: '^/tutorials/', link: '/tutorials/en_US/getting-started', text: 'Tutorials' },
115+
{ activeMatch: '^/plugins', link: '/plugins', text: 'Plugins' },
116+
{
117+
activeMatch: '^/resources/',
118+
link: '/resources/changelog',
119+
text: 'Resources',
120+
},
121+
{ activeMatch: '^/module/', link: '/module/', text: 'Modules' },
122+
{ activeMatch: '^/policies/', link: '/policies/coc', text: 'Policies' },
123+
{ link: '/support', text: 'Support' },
124+
{ link: 'https://hapi.threadless.com', target: '_blank', text: 'Shop' },
125+
],
126+
outline: {
127+
label: 'On this page',
128+
level: 'deep',
129+
},
130+
sidebar: {
131+
'/api/': [
132+
{
133+
items: [
134+
{
135+
items: [...hapiInfo.versions].toReversed().map((version) => ({
136+
link: `/api/${formatVersion(version.name)}`,
137+
text: formatVersion(version.name),
138+
})),
139+
link: `/api/${formatVersion(hapiInfo.versions.at(-1)!.name)}`,
140+
text: 'API',
141+
},
142+
],
143+
text: '@hapi/hapi',
144+
},
145+
],
146+
'/module/': [
147+
{
148+
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
149+
text: 'Modules',
150+
},
151+
],
152+
'/plugins': [
153+
{
154+
items: pluginsData.map((category) => ({
155+
link: `/plugins#${category.anchor}`,
156+
text: category.name,
157+
})),
158+
text: 'Plugins',
159+
},
160+
],
161+
'/policies/': [
162+
{
163+
items: [
164+
{ link: '/policies/coc', text: 'Code of Conduct' },
165+
{ link: '/policies/contributing', text: 'Contributing' },
166+
{ link: '/policies/license', text: 'License' },
167+
{ link: '/policies/security', text: 'Security' },
168+
{ link: '/policies/sponsors', text: 'Sponsors' },
169+
{ link: '/policies/styleguide', text: 'Style Guide' },
170+
{ link: '/policies/support', text: 'Support' },
171+
],
172+
text: 'Policies',
173+
},
174+
],
175+
'/resources/': [
176+
{
177+
items: [
178+
{ link: '/resources/changelog', text: 'Changelog' },
179+
{ link: '/resources/status', text: 'Module Status' },
180+
{ link: '/resources/list#books', text: 'Books' },
181+
{ link: '/resources/list#boilerplates', text: 'Boilerplates' },
182+
{ link: '/resources/list#projects', text: 'Projects' },
183+
{ link: '/resources/list#videos', text: 'Videos' },
184+
],
185+
text: 'Resources',
186+
},
187+
],
188+
'/tutorials/en_US/': getTutorialSidebar('en_US'),
189+
'/tutorials/ko_KR/': getTutorialSidebar('ko_KR'),
190+
'/tutorials/pt_BR/': getTutorialSidebar('pt_BR'),
191+
'/tutorials/tr_TR/': getTutorialSidebar('tr_TR'),
192+
'/tutorials/zh_CN/': getTutorialSidebar('zh_CN'),
193+
...moduleSidebars,
194+
},
195+
socialLinks: [
196+
{ icon: 'github', link: 'https://github.com/hapijs/hapi' },
197+
{ icon: 'slack', link: 'https://join.slack.com/t/hapihour/shared_invite/zt-g5ortpsk-ErlnRA2rUcPIWES21oXBOg' },
198+
{ icon: 'discord', link: 'https://discord.gg/YYxZhpKKvu' },
199+
],
200+
},
201+
title: 'hapi.dev',
202+
titleTemplate: 'hapi.dev - :title',
203+
vite: {
204+
plugins: [groupIconVitePlugin()],
205+
},
206+
});
131 KB
Binary file not shown.
135 KB
Binary file not shown.

0 commit comments

Comments
 (0)