Skip to content

Commit 186f44d

Browse files
authored
convert docs to Vitepress (#510)
1 parent e050e93 commit 186f44d

49 files changed

Lines changed: 3785 additions & 1372 deletions

Some content is hidden

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

Dockerfile

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1-
# Basic docker based environment
2-
# Necessary to trick dokku into building the documentation
3-
# using dockerfile instead of herokuish
4-
FROM php:8.1
1+
# ----------------------
2+
# 1. Build stage
3+
# ----------------------
4+
FROM node:22-alpine AS builder
55

6-
WORKDIR /code
6+
# Git is required because docs/package.json pulls a dependency from GitHub.
7+
RUN apk add --no-cache git openssh-client
78

8-
VOLUME ["/code"]
9+
WORKDIR /app/docs
910

10-
CMD [ '/bin/bash' ]
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.Dockerfile

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

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

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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"/": [
3+
{
4+
"text": "CakePHP Chronos",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Introduction", "link": "/index" },
8+
{ "text": "3.x Migration Guide", "link": "/3-x-migration-guide" },
9+
{ "text": "API", "link": "https://api.cakephp.org/chronos" }
10+
]
11+
}
12+
]
13+
}

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 Chronos",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Introduction", "link": "/fr/index" },
8+
{ "text": "API", "link": "https://api.cakephp.org/chronos" }
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 Chronos",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "概要", "link": "/ja/index" },
8+
{ "text": "API", "link": "https://api.cakephp.org/chronos" }
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 Chronos",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Introdução", "link": "/pt/index" },
8+
{ "text": "API", "link": "https://api.cakephp.org/chronos" }
9+
]
10+
}
11+
]
12+
}

docs/config/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)