Skip to content

Commit 669ab45

Browse files
authored
convert docs to Vitepress (#343)
1 parent 873a397 commit 669ab45

45 files changed

Lines changed: 3317 additions & 1132 deletions

Some content is hidden

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

.github/workflows/deploy_docs_5x.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Cloning repo
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v6
1616
with:
1717
fetch-depth: 0
1818

1919
- name: Push to dokku
2020
uses: dokku/github-action@master
2121
with:
2222
git_remote_url: 'ssh://dokku@apps.cakephp.org:22/elasticsearch-docs-5'
23+
git_push_flags: '-f'
2324
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
2425
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# ----------------------
2+
# 1. Build stage
3+
# ----------------------
4+
FROM node:24-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 (angie)
23+
# ----------------------
24+
FROM docker.angie.software/angie:latest AS runner
25+
26+
# Copy built files
27+
COPY --from=builder /app/docs/.vitepress/dist /usr/share/angie/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 angie
36+
CMD ["angie", "-g", "daemon off;"]

docs.Dockerfile

Lines changed: 0 additions & 26 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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 tocJa = require('./toc_ja.json')
7+
8+
const versions = {
9+
text: '5.x',
10+
items: [
11+
{ text: '5.x (current)', link: 'https://book.cakephp.org/elasticsearch/5/', target: '_self' },
12+
{ text: '4.x', link: 'https://book.cakephp.org/elasticsearch/4/', target: '_self' },
13+
{ text: '3.x', link: 'https://book.cakephp.org/elasticsearch/3/', target: '_self' },
14+
],
15+
}
16+
17+
export default {
18+
extends: baseConfig,
19+
srcDir: '.',
20+
title: 'ElasticSearch',
21+
description: 'CakePHP ElasticSearch Documentation',
22+
base: '/elasticsearch/5/',
23+
rewrites: {
24+
'en/:slug*': ':slug*',
25+
'ja/:slug*': 'ja/:slug*',
26+
},
27+
sitemap: {
28+
hostname: 'https://book.cakephp.org/elasticsearch/5/',
29+
},
30+
themeConfig: {
31+
siteTitle: false,
32+
pluginName: 'ElasticSearch',
33+
socialLinks: [
34+
{ icon: 'github', link: 'https://github.com/cakephp/elastic-search' },
35+
],
36+
editLink: {
37+
pattern: 'https://github.com/cakephp/elastic-search/edit/5.x/docs/:path',
38+
text: 'Edit this page on GitHub',
39+
},
40+
sidebar: tocEn,
41+
nav: [
42+
{ text: 'CakePHP', link: 'https://cakephp.org' },
43+
{ text: 'API', link: 'https://api.cakephp.org/elasticsearch/' },
44+
{ ...versions },
45+
],
46+
},
47+
locales: {
48+
root: {
49+
label: 'English',
50+
lang: 'en',
51+
themeConfig: {
52+
sidebar: tocEn,
53+
},
54+
},
55+
ja: {
56+
label: 'Japanese',
57+
lang: 'ja',
58+
link: '/ja/',
59+
themeConfig: {
60+
sidebar: tocJa,
61+
},
62+
},
63+
},
64+
}

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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"/": [
3+
{
4+
"text": "Getting Started",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "Installation and Configuration", "link": "/installation" },
8+
{ "text": "Indexes and Documents", "link": "/indexes-and-documents" },
9+
{ "text": "Searching and Saving", "link": "/searching-and-saving" }
10+
]
11+
},
12+
{
13+
"text": "Advanced Topics",
14+
"collapsed": false,
15+
"items": [
16+
{ "text": "Embedded Documents", "link": "/embedded-documents" },
17+
{ "text": "Testing", "link": "/testing" }
18+
]
19+
},
20+
{
21+
"text": "Migration",
22+
"collapsed": false,
23+
"items": [
24+
{ "text": "5.0 Upgrade Guide", "link": "/5-0-upgrade-guide" },
25+
{ "text": "4.0 Upgrade Guide", "link": "/4-0-upgrade-guide" },
26+
{ "text": "3.0 Upgrade Guide", "link": "/3-0-upgrade-guide" }
27+
]
28+
}
29+
]
30+
}

docs/.vitepress/toc_ja.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"/ja/": [
3+
{
4+
"text": "ドキュメント",
5+
"collapsed": false,
6+
"items": [
7+
{ "text": "ElasticSearch", "link": "/ja/" }
8+
]
9+
}
10+
]
11+
}

docs/config/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)