Skip to content

Commit 83d154b

Browse files
authored
Merge pull request #1068 from cakephp/5.x-vitepress
convert docs to Vitepress
2 parents 3a310f3 + beafc04 commit 83d154b

Some content is hidden

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

59 files changed

+1183
-1215
lines changed

.github/workflows/deploy_docs_5x.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ jobs:
2222
git_remote_url: 'ssh://dokku@apps.cakephp.org:22/debugkit-docs-5'
2323
git_push_flags: '-f'
2424
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
25+
branch: '5.x'
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Documentation Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- 5.x
7+
paths:
8+
- 'docs/**'
9+
- '.github/**'
10+
pull_request:
11+
paths:
12+
- 'docs/**'
13+
- '.github/**'
14+
15+
jobs:
16+
validate:
17+
uses: cakephp/.github/.github/workflows/docs-validation.yml@5.x
18+
with:
19+
docs-path: 'docs'
20+
vitepress-path: 'docs/.vitepress'
21+
enable-config-js-check: true
22+
enable-json-lint: true
23+
enable-toc-check: true
24+
enable-spell-check: true
25+
enable-markdown-lint: true
26+
enable-link-check: true
27+
tools-ref: '5.x'

Dockerfile

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
1-
# Basic docker based environment
2-
# Necessary to trick dokku into building the documentation
3-
# using dockerfile instead of herokuish
4-
FROM ubuntu:22.04
5-
6-
# Add basic tools
7-
RUN apt-get update && \
8-
apt-get install -y build-essential \
9-
software-properties-common \
10-
curl \
11-
git \
12-
libxml2 \
13-
libffi-dev \
14-
libssl-dev
15-
16-
# Prevent interactive timezone input
17-
ENV DEBIAN_FRONTEND=noninteractive
18-
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php && \
19-
apt-get update && \
20-
apt-get install -y php8.1-cli php8.1-mbstring php8.1-xml php8.1-zip php8.1-intl php8.1-opcache php8.1-sqlite
21-
22-
WORKDIR /code
23-
24-
VOLUME ["/code"]
25-
26-
CMD [ '/bin/bash' ]
1+
# ----------------------
2+
# 1. Build stage
3+
# ----------------------
4+
FROM node:22-alpine AS builder
5+
6+
# Git is required because docs/package.json pulls a dependency from GitHub.
7+
RUN apk add --no-cache git openssh-client
8+
9+
WORKDIR /app/docs
10+
11+
# Copy dependency manifests first to preserve Docker layer caching.
12+
COPY docs/ ./
13+
RUN npm ci
14+
15+
# Increase max-old-space-size to avoid memory issues during build
16+
ENV NODE_OPTIONS="--max-old-space-size=8192"
17+
18+
# Build the site.
19+
RUN npm run docs:build
20+
21+
# ----------------------
22+
# 2. Runtime stage (nginx)
23+
# ----------------------
24+
FROM nginx:1.27-alpine AS runner
25+
26+
# Copy built files
27+
COPY --from=builder /app/docs/.vitepress/dist /usr/share/nginx/html
28+
29+
# Expose port
30+
EXPOSE 80
31+
32+
# Health check (optional)
33+
HEALTHCHECK CMD wget --quiet --tries=1 --spider http://localhost:80/ || exit 1
34+
35+
# Start nginx
36+
CMD ["nginx", "-g", "daemon off;"]

docs/.gitignore

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

docs/.vitepress/config.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import baseConfig from '@cakephp/docs-skeleton/config'
2+
import { createRequire } from 'module'
3+
4+
const require = createRequire(import.meta.url)
5+
const tocEn = require('./toc_en.json')
6+
const tocFr = require('./toc_fr.json')
7+
const tocJa = require('./toc_ja.json')
8+
const tocPt = require('./toc_pt.json')
9+
10+
const versions = {
11+
text: '5.x',
12+
items: [
13+
{ text: '5.x (current)', link: 'https://book.cakephp.org/debugkit/5/', target: '_self' },
14+
{ text: '4.x', link: 'https://book.cakephp.org/debugkit/4/en/', target: '_self' },
15+
],
16+
}
17+
18+
export default {
19+
extends: baseConfig,
20+
srcDir: '.',
21+
title: 'DebugKit',
22+
description: 'CakePHP DebugKit Documentation',
23+
base: '/debugkit/5/',
24+
rewrites: {
25+
'en/:slug*': ':slug*',
26+
},
27+
sitemap: {
28+
hostname: 'https://book.cakephp.org/debugkit/5/',
29+
},
30+
themeConfig: {
31+
socialLinks: [
32+
{ icon: 'github', link: 'https://github.com/cakephp/debug_kit' },
33+
],
34+
editLink: {
35+
pattern: 'https://github.com/cakephp/debug_kit/edit/5.x/docs/:path',
36+
text: 'Edit this page on GitHub',
37+
},
38+
sidebar: tocEn,
39+
nav: [
40+
{ text: 'CakePHP', link: 'https://cakephp.org' },
41+
{ text: 'API', link: 'https://api.cakephp.org/debugkit/' },
42+
{ ...versions },
43+
],
44+
},
45+
locales: {
46+
root: {
47+
label: 'English',
48+
lang: 'en',
49+
themeConfig: {
50+
sidebar: tocEn,
51+
},
52+
},
53+
fr: {
54+
label: 'Français',
55+
lang: 'fr',
56+
themeConfig: {
57+
sidebar: tocFr,
58+
},
59+
},
60+
ja: {
61+
label: '日本語',
62+
lang: 'ja',
63+
themeConfig: {
64+
sidebar: tocJa,
65+
},
66+
},
67+
pt: {
68+
label: 'Português',
69+
lang: 'pt',
70+
themeConfig: {
71+
sidebar: tocPt,
72+
},
73+
},
74+
},
75+
}

docs/.vitepress/theme/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@cakephp/docs-skeleton'

docs/.vitepress/toc_en.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"/": [
3+
{
4+
"text": "Getting Started",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Overview", "link": "/" },
8+
{ "text": "Configuration", "link": "/configuration" },
9+
{ "text": "Toolbar Usage", "link": "/toolbar" }
10+
]
11+
},
12+
{
13+
"text": "Panels",
14+
"collapsed": false,
15+
"items": [
16+
{ "text": "History Panel", "link": "/history-panel" },
17+
{ "text": "Mail Panel", "link": "/mail-panel" },
18+
{ "text": "Custom Panels", "link": "/custom-panels" }
19+
]
20+
},
21+
{
22+
"text": "Advanced",
23+
"collapsed": false,
24+
"items": [
25+
{ "text": "API Requests", "link": "/api-requests" },
26+
{ "text": "Helper Functions", "link": "/helper-functions" },
27+
{ "text": "API", "link": "https://api.cakephp.org/debugkit/" }
28+
]
29+
}
30+
]
31+
}

docs/.vitepress/toc_fr.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"/fr/": [
3+
{
4+
"text": "CakePHP DebugKit",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Aperçu", "link": "/fr/" },
8+
{ "text": "API", "link": "https://api.cakephp.org/debugkit/" }
9+
]
10+
}
11+
]
12+
}

docs/.vitepress/toc_ja.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"/ja/": [
3+
{
4+
"text": "CakePHP DebugKit",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "概要", "link": "/ja/" },
8+
{ "text": "API", "link": "https://api.cakephp.org/debugkit/" }
9+
]
10+
}
11+
]
12+
}

docs/.vitepress/toc_pt.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"/pt/": [
3+
{
4+
"text": "CakePHP DebugKit",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Visão geral", "link": "/pt/" },
8+
{ "text": "API", "link": "https://api.cakephp.org/debugkit/" }
9+
]
10+
}
11+
]
12+
}

0 commit comments

Comments
 (0)