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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test

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

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
41 changes: 6 additions & 35 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,17 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
# TypeScript declaration files
typings/

# Optional npm cache directory
Expand All @@ -59,32 +44,18 @@ typings/
# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
# vitepress build output
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless
.vitepress/cache

# IDE / Editor
.idea

# Service worker
sw.*

# macOS
.DS_Store

# Vim swap files
*.swp

# Service worker (if any)
sw.*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.18.1
24.14.0
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",
"defineEmits": "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"
}
}
3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

152 changes: 152 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import { defineConfig } from 'vitepress';
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';

import modulesData from '../generated/metadata/modules.json' with { type: 'json' };
import joiInfo from '../generated/modules/joi/info.json' with { type: 'json' };
import { formatVersion } from './utils.js';

const modulesItems = Object.keys(modulesData)
.filter((name) => name !== 'joi')
.map((name) => ({
link: `/module/${name}/install`,
text: name,
}));

const getModuleSidebar = (moduleName: string) => {
const moduleData = modulesData[moduleName as keyof typeof modulesData];
return [
{
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
text: 'Modules',
},
{
items: [
{ link: `/module/${moduleName}/install`, text: 'Installation' },
{
items: moduleData.versions.map((version) => ({
link: `/module/${moduleName}/api/${formatVersion(version.name)}`,
text: formatVersion(version.name),
})),
link: `/module/${moduleName}/api/${formatVersion(moduleData.versions[0].name)}`,
text: 'API',
},
{ link: `/module/${moduleName}/changelog`, text: 'Changelog' },
],
text: moduleName,
},
];
};

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

export default defineConfig({
appearance: true,
cleanUrls: true,
description: 'The most powerful data validation library for JS',
head: [['link', { href: '/favicon2.png', rel: 'icon' }]],
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/img/global/badges/netlify-dark.svg" alt="Deploys by Netlify" style="display: inline-block; vertical-align: middle; height: 20px; margin-left: 10px;" /></a>',
},
logo: '/img/joiTransparent.png',
nav: [
{ link: '/', text: 'Home' },
{ activeMatch: '^/api/', link: `/api/${formatVersion(joiInfo.versionsArray[0])}`, text: 'API' },
{
activeMatch: '^/resources/',
link: '/resources/changelog',
text: 'Resources',
},
{ activeMatch: '^/module/', link: '/module/', text: 'Modules' },
{ activeMatch: '^/policies/', link: '/policies/coc', text: 'Policies' },
{ activeMatch: '^/tester/', link: '/tester/', text: 'Sandbox' },
],
outline: {
label: 'On this page',
level: 'deep',
},
sidebar: {
'/api/': [
{
items: [
{
items: joiInfo.versionsArray.map((version) => ({
link: `/api/${formatVersion(version)}`,
text: formatVersion(version),
})),
link: `/api/${formatVersion(joiInfo.versionsArray[0])}`,
text: 'API',
},
],
text: 'joi',
},
],
'/module/': [
{
items: [{ link: '/module/', text: 'All Modules' }, ...modulesItems],
text: 'Modules',
},
],
'/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/styleguide', text: 'Style Guide' },
{ link: '/policies/support', text: 'Support' },
],
text: 'Policies',
},
],
'/resources/': [
{
items: [
{ link: '/resources/changelog', text: 'Changelog' },
{ link: '/resources/status', text: 'Module Status' },
],
text: 'Resources',
},
],
'/tester/': [
{
items: joiInfo.versionsArray.map((version) => ({
link: `/tester/${formatVersion(version)}`,
text: formatVersion(version),
})),
text: 'Versions',
},
],
...moduleSidebars,
},
socialLinks: [{ icon: 'github', link: 'https://github.com/hapijs/joi' }],
},
title: 'joi.dev',
titleTemplate: 'joi.dev - :title',
vite: {
plugins: [groupIconVitePlugin()],
},
});
42 changes: 42 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import DefaultTheme from 'vitepress/theme';
import { h } from 'vue';

import './variables.css';
import './main.css';
import 'virtual:group-icons.css';
import CarbonAds from '../../components/CarbonAds.vue';
import ModuleIndex from '../../components/ModuleIndex.vue';
import StatusContent from '../../components/StatusContent.vue';
import TesterContent from '../../components/TesterContent.vue';
import { getRedirectPath } from './redirect.js';

import type { Theme } from 'vitepress';

export default {
Layout() {
return h(DefaultTheme.Layout, null, {
'sidebar-nav-after': () => h(CarbonAds),
});
},
enhanceApp({ app, router }) {
app.component('ModuleIndex', ModuleIndex);
app.component('StatusContent', StatusContent);
app.component('TesterContent', TesterContent);

if (typeof window !== 'undefined') {
router.onBeforeRouteChange = (to) => {
const target = getRedirectPath(to);
if (target) {
router.go(target);
return false;
}
};

const initialTarget = getRedirectPath(window.location.pathname);
if (initialTarget) {
router.go(initialTarget);
}
}
},
extends: DefaultTheme,
} satisfies Theme;
Loading