Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 0 additions & 28 deletions .eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v5
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm test
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ typings/
# nuxt.js build output
.nuxt

# Nuxt generate
# Build output
dist

# vuepress build output
.vuepress/dist
# vitepress build output
dist
.vitepress/cache

# Serverless directories
.serverless
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.14.0
24.14.1
25 changes: 25 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"singleQuote": true,
"printWidth": 120,
"sortPackageJson": false,
"sortImports": {
"groups": [
"builtin",
"external",
["internal", "parent", "sibling", "index"],
"type-builtin",
"type-external",
["type-internal", "type-parent", "type-sibling", "type-index"]
]
},
"ignorePatterns": [],
"overrides": [
{
"files": ["generated/**"],
"options": {
"printWidth": 80
}
}
]
}
38 changes: 38 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "unicorn", "vue"],
"env": {
"node": true,
"browser": true
},
"categories": {
"correctness": "error",
"perf": "error",
"suspicious": "error",
"pedantic": "warn",
"style": "warn",
"nursery": "warn"
},
"globals": {
"defineProps": "readonly",
"defineModel": "readonly"
},
"rules": {
"id-length": "off",
"init-declarations": "off",
"max-depth": "off",
"max-lines-per-function": "off",
"max-params": "off",
"max-statements": "off",
"no-await-in-loop": "off",
"no-duplicate-imports": ["error", { "allowSeparateTypeImports": true }],
"no-magic-numbers": "off",
"no-ternary": "off",
"prefer-global-this": "off",
"sort-imports": "off",
"typescript/consistent-type-imports": ["error", { "prefer": "type-imports", "fixStyle": "separate-type-imports" }],
"unicorn/filename-case": "off",
"unicorn/no-null": "off",
"unicorn/prefer-node-protocol": "error"
}
}
206 changes: 206 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import { defineConfig } from 'vitepress';
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';

import modulesData from '../generated/metadata/modules.json' with { type: 'json' };
import hapiInfo from '../generated/modules/hapi/info.json' with { type: 'json' };
import pluginsData from '../src/plugins.json' with { type: 'json' };
import { formatVersion } from './utils.js';

const modulesItems = Object.keys(modulesData)
.filter((name) => name !== 'hapi')
.map((name) => ({
link: `/module/${name}/api/${modulesData[name as keyof typeof modulesData].latestVersion}`,
text: name,
}));

const getModuleSidebar = (moduleName: string) => {
const moduleData = modulesData[moduleName as keyof typeof modulesData];

const items: { link: string; text: string; items?: { link: string; text: string }[] }[] = [
{
items: [...moduleData.versions].toReversed().map((version) => ({
link: `/module/${moduleName}/api/${formatVersion(version.name)}`,
text: formatVersion(version.name),
})),
link: `/module/${moduleName}/api/${moduleData.latestVersion}`,
text: 'API',
},
{ link: `/module/${moduleName}/changelog`, text: 'Changelog' },
];

if (moduleName === 'bell') {
items.push({ link: '/module/bell/examples', text: 'Examples' });
items.push({ link: '/module/bell/providers', text: 'Providers' });
}

return [
{
items,
text: moduleName,
},
{
collapsed: true,
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
text: 'Other Modules',
},
];
};

const moduleSidebars = Object.fromEntries(
Object.keys(modulesData)
.filter((name) => name !== 'hapi')
.map((name) => [`/module/${name}/`, getModuleSidebar(name)]),
);

const tutorialItems = [
{ slug: 'getting-started', text: 'Getting Started' },
{ slug: 'auth', text: 'Authentication' },
{ slug: 'caching', text: 'Caching' },
{ slug: 'cookies', text: 'Cookies' },
{ slug: 'logging', text: 'Logging' },
{ slug: 'plugins', text: 'Plugins' },
{ slug: 'routing', text: 'Routing' },
{ slug: 'server-methods', text: 'Server Methods' },
{ slug: 'serving-files', text: 'Serving Files' },
{ slug: 'testing', text: 'Testing' },
{ slug: 'validation', text: 'Validation' },
{ slug: 'views', text: 'Views' },
{ slug: 'community', text: 'Community' },
{ slug: 'express-to-hapi', text: 'Express to hapi' },
];

const getTutorialSidebar = (locale: string) => [
{
items: tutorialItems.map((t) => ({
link: `/tutorials/${locale}/${t.slug}`,
text: t.text,
})),
text: 'Tutorials',
},
];

export default defineConfig({
appearance: true,
cleanUrls: true,
description: 'The Simple, Secure Framework Developers Trust',
head: [['link', { href: '/favicon.png', rel: 'icon', type: 'image/png' }]],
ignoreDeadLinks: true,
markdown: {
config(md) {
md.use(groupIconMdPlugin);
},
lineNumbers: true,
theme: {
dark: 'vitesse-dark',
light: 'vitesse-light',
},
},
outDir: 'dist',
srcDir: 'docs',
themeConfig: {
docFooter: {
next: false,
prev: false,
},
footer: {
copyright: 'Copyright © 2012-present hapi.js team',
message:
'<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>',
},
logo: '/img/hapi.svg',
nav: [
{ link: '/', text: 'Home' },
{ activeMatch: '^/api/', link: `/api/${formatVersion(hapiInfo.versions.at(-1)!.name)}`, text: 'API' },
{ activeMatch: '^/tutorials/', link: '/tutorials/en_US/getting-started', text: 'Tutorials' },
{ activeMatch: '^/plugins', link: '/plugins', text: 'Plugins' },
{
activeMatch: '^/resources/',
link: '/resources/changelog',
text: 'Resources',
},
{ activeMatch: '^/module/', link: '/module/', text: 'Modules' },
{ activeMatch: '^/policies/', link: '/policies/coc', text: 'Policies' },
{ link: '/support', text: 'Support' },
{ link: 'https://hapi.threadless.com', target: '_blank', text: 'Shop' },
],
outline: {
label: 'On this page',
level: 'deep',
},
sidebar: {
'/api/': [
{
items: [
{
items: [...hapiInfo.versions].toReversed().map((version) => ({
link: `/api/${formatVersion(version.name)}`,
text: formatVersion(version.name),
})),
link: `/api/${formatVersion(hapiInfo.versions.at(-1)!.name)}`,
text: 'API',
},
],
text: '@hapi/hapi',
},
],
'/module/': [
{
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
text: 'Modules',
},
],
'/plugins': [
{
items: pluginsData.map((category) => ({
link: `/plugins#${category.anchor}`,
text: category.name,
})),
text: 'Plugins',
},
],
'/policies/': [
{
items: [
{ link: '/policies/coc', text: 'Code of Conduct' },
{ link: '/policies/contributing', text: 'Contributing' },
{ link: '/policies/license', text: 'License' },
{ link: '/policies/security', text: 'Security' },
{ link: '/policies/sponsors', text: 'Sponsors' },
{ link: '/policies/styleguide', text: 'Style Guide' },
{ link: '/policies/support', text: 'Support' },
],
text: 'Policies',
},
],
'/resources/': [
{
items: [
{ link: '/resources/changelog', text: 'Changelog' },
{ link: '/resources/status', text: 'Module Status' },
{ link: '/resources/list#books', text: 'Books' },
{ link: '/resources/list#boilerplates', text: 'Boilerplates' },
{ link: '/resources/list#projects', text: 'Projects' },
{ link: '/resources/list#videos', text: 'Videos' },
],
text: 'Resources',
},
],
'/tutorials/en_US/': getTutorialSidebar('en_US'),
'/tutorials/ko_KR/': getTutorialSidebar('ko_KR'),
'/tutorials/pt_BR/': getTutorialSidebar('pt_BR'),
'/tutorials/tr_TR/': getTutorialSidebar('tr_TR'),
'/tutorials/zh_CN/': getTutorialSidebar('zh_CN'),
...moduleSidebars,
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/hapijs/hapi' },
{ icon: 'slack', link: 'https://join.slack.com/t/hapihour/shared_invite/zt-g5ortpsk-ErlnRA2rUcPIWES21oXBOg' },
{ icon: 'discord', link: 'https://discord.gg/YYxZhpKKvu' },
],
},
title: 'hapi.dev',
titleTemplate: 'hapi.dev - :title',
vite: {
plugins: [groupIconVitePlugin()],
},
});
Binary file added .vitepress/theme/fonts/IBMPlexMono-Regular.ttf
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexMono-SemiBold.ttf
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexSans-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexSans-Italic.ttf
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexSans-Medium.ttf
Binary file not shown.
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexSans-Regular.ttf
Binary file not shown.
Binary file added .vitepress/theme/fonts/IBMPlexSans-SemiBold.ttf
Binary file not shown.
Binary file not shown.
Loading