Skip to content

Commit f162b9f

Browse files
committed
Refactor build to cake's new node based vitepress theme package
1 parent d8db449 commit f162b9f

File tree

14 files changed

+2255
-350
lines changed

14 files changed

+2255
-350
lines changed

.github/workflows/docs-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
uses: actions/checkout@v6
5858

5959
- name: Check TOC links exist
60-
run: node bin/check-toc-links.js
60+
run: node .github/check-toc-links.js
6161

6262
markdown-lint:
6363
name: Lint Markdown
@@ -121,4 +121,4 @@ jobs:
121121
122122
- name: Check internal links
123123
if: steps.changed-files.outputs.files != ''
124-
run: node bin/check-links.js --baseline .github/linkchecker-baseline.json ${{ steps.changed-files.outputs.files }}
124+
run: node .github/check-links.js --baseline .github/linkchecker-baseline.json ${{ steps.changed-files.outputs.files }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
.vitepress/.temp
66
/node_modules/
77
.temp/
8+
docs/public/favicon/
9+
docs/public/fonts/
10+
docs/public/icons/
11+
docs/public/logo.svg
812

913
# IDE and editor specific files #
1014
#################################

.vitepress/config.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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_ja = require("./toc_ja.json");
7+
8+
const versions = {
9+
text: "5.x",
10+
items: [
11+
{ text: "5.x (latest)", link: "https://book.cakephp.org/5.x/", target: '_self' },
12+
{ text: "4.x", link: "https://book.cakephp.org/4.x/", target: '_self' },
13+
{ text: "3.x", link: "https://book.cakephp.org/3.x/", target: '_self' },
14+
{ text: "2.x", link: "https://book.cakephp.org/2.x/", target: '_self' },
15+
{ text: "Next releases", items: [
16+
{ text: "5.next", link: "https://book.cakephp.org/5.next/", target: '_self' },
17+
{ text: "6.x", link: "https://book.cakephp.org/6.x/", target: '_self' },
18+
]},
19+
],
20+
};
21+
22+
// This file contains overrides for .vitepress/config.js
23+
export default {
24+
extends: baseConfig,
25+
base: "/5.x/",
26+
rewrites: {
27+
"en/:slug*": ":slug*",
28+
},
29+
sitemap: {
30+
hostname: "https://book.cakephp.org/5.x/",
31+
},
32+
themeConfig: {
33+
socialLinks: [
34+
{ icon: "github", link: "https://github.com/cakephp/cakephp" },
35+
],
36+
editLink: {
37+
pattern: "https://github.com/cakephp/docs/edit/5.x/docs/:path",
38+
text: "Edit this page on GitHub",
39+
},
40+
sidebar: toc_en,
41+
nav: [
42+
{ text: "Guide", link: "/intro" },
43+
{ text: "API", link: "https://api.cakephp.org/" },
44+
{ text: "Documentation", link: "/" },
45+
{ ...versions },
46+
],
47+
},
48+
substitutions: {
49+
'|phpversion|': { value: '8.5', format: 'bold' },
50+
'|minphpversion|': { value: '8.2', format: 'italic' },
51+
'|cakeversion|': '5.3',
52+
'|cakefullversion|': 'CakePHP 5',
53+
},
54+
locales: {
55+
root: {
56+
label: "English",
57+
lang: "en",
58+
},
59+
ja: {
60+
label: "Japanese",
61+
lang: "ja",
62+
themeConfig: {
63+
nav: [
64+
{ text: "ガイド", link: "/ja/intro" },
65+
{ text: "API", link: "https://api.cakephp.org/" },
66+
{ text: "ドキュメント", link: "/ja/" },
67+
{ ...versions },
68+
],
69+
sidebar: toc_ja,
70+
},
71+
},
72+
},
73+
};

.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'
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,29 @@ files, marked up with Markdown formatting.
1616

1717
## Local Development
1818

19-
For working with the documentation markdown files locally, use the provided development server script:
19+
Install dependencies, then start the VitePress development server:
2020

2121
```bash
22-
./bin/dev-server.sh
22+
npm install
23+
npm run docs:dev
2324
```
2425

25-
This script will:
26-
- Set up a clean `.temp` working directory
27-
- Clone the VitePress skeleton repository
28-
- Sync your documentation files
29-
- Install dependencies
30-
- Start a local development server with hot-reload
26+
The documentation will be available at `http://localhost:5173` with hot-reload enabled.
3127

32-
The documentation will be available at `http://localhost:5173`
33-
34-
### Development Server Options
28+
### Other Commands
3529

3630
```bash
37-
# Start on a custom port
38-
./bin/dev-server.sh --port 3000
31+
# Build the static site
32+
npm run docs:build
3933

40-
# Adjust docs sync interval (default: 1 second)
41-
./bin/dev-server.sh --sync-interval 2
34+
# Preview the production build locally
35+
npm run docs:preview
4236
```
4337

4438
### Prerequisites
4539

46-
The development server requires:
47-
- `git` - Version control
4840
- `node` - JavaScript runtime
4941
- `npm` - Package manager
50-
- `rsync` - File synchronization
51-
52-
Press `Ctrl+C` to stop the development server.
5342

5443
## Build the Documentation with Docker
5544

0 commit comments

Comments
 (0)