Skip to content

Commit 2dd27c1

Browse files
Merge pull request #151 from TheDragonCode/4.x
Upgrade Vuepress
2 parents 085479f + ef160e0 commit 2dd27c1

File tree

3 files changed

+49
-44
lines changed

3 files changed

+49
-44
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525

2626
- name: Setup Node.js
2727
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
2830

2931
- name: Cache dependencies
3032
uses: actions/cache@v4

docs/.vuepress/config.js

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,63 @@ import fs from 'fs'
22
import path from 'path'
33
import dotenv from 'dotenv'
44

5-
import { defaultTheme, viteBundler } from 'vuepress'
5+
import {viteBundler} from '@vuepress/bundler-vite'
6+
import {defaultTheme} from '@vuepress/theme-default'
7+
import {defineUserConfig} from 'vuepress'
68

79
dotenv.config()
810

11+
function getChildren(folder, sort = 'asc') {
12+
const extension = ['.md']
13+
const names = ['index.md', 'readme.md']
14+
15+
const dir = `${__dirname}/../${folder}`
16+
17+
return fs
18+
.readdirSync(path.join(dir))
19+
.filter(item =>
20+
fs.statSync(path.join(dir, item)).isFile() &&
21+
!names.includes(item.toLowerCase()) &&
22+
extension.includes(path.extname(item))
23+
)
24+
.sort((a, b) => {
25+
a = resolveNumeric(a)
26+
b = resolveNumeric(b)
27+
28+
if (a < b) return sort === 'asc' ? -1 : 1
29+
if (a > b) return sort === 'asc' ? 1 : -1
30+
31+
return 0
32+
}).map(item => `/${folder}/${item}`)
33+
}
34+
35+
function resolveNumeric(value) {
36+
const sub = value.substring(0, value.indexOf('.'))
37+
38+
const num = Number(sub)
39+
40+
return isNaN(num) ? value : num
41+
}
42+
943
const hostname = 'actions.dragon-code.pro'
1044

11-
module.exports = {
45+
export default defineUserConfig({
46+
bundler: viteBundler(),
47+
1248
lang: 'en-US',
1349
title: 'Dragon Code: Actions',
1450
description: 'Performing actions with saving the list of called files',
1551

1652
head: [
17-
['link', { rel: 'icon', href: `https://${ hostname }/images/logo.svg` }],
18-
['meta', { name: 'twitter:image', content: `https://${ hostname }/images/logo.svg` }]
53+
['link', {rel: 'icon', href: `https://${hostname}/images/logo.svg`}],
54+
['meta', {name: 'twitter:image', content: `https://${hostname}/images/logo.svg`}]
1955
],
2056

21-
bundler: viteBundler(),
22-
2357
theme: defaultTheme({
2458
hostname,
2559
base: '/',
2660

27-
logo: `https://${ hostname }/images/logo.svg`,
61+
logo: `https://${hostname}/images/logo.svg`,
2862

2963
repo: 'https://github.com/TheDragonCode/laravel-actions',
3064
repoLabel: 'GitHub',
@@ -36,7 +70,7 @@ module.exports = {
3670
editLink: true,
3771

3872
navbar: [
39-
{ text: '4.x', link: '/prologue/changelog/4.x.md' }
73+
{text: '4.x', link: '/prologue/changelog/4.x.md'}
4074
],
4175

4276
sidebarDepth: 1,
@@ -83,36 +117,4 @@ module.exports = {
83117
}
84118
]
85119
})
86-
}
87-
88-
function getChildren(folder, sort = 'asc') {
89-
const extension = ['.md']
90-
const names = ['index.md', 'readme.md']
91-
92-
const dir = `${ __dirname }/../${ folder }`
93-
94-
return fs
95-
.readdirSync(path.join(dir))
96-
.filter(item =>
97-
fs.statSync(path.join(dir, item)).isFile() &&
98-
! names.includes(item.toLowerCase()) &&
99-
extension.includes(path.extname(item))
100-
)
101-
.sort((a, b) => {
102-
a = resolveNumeric(a)
103-
b = resolveNumeric(b)
104-
105-
if (a < b) return sort === 'asc' ? -1 : 1
106-
if (a > b) return sort === 'asc' ? 1 : -1
107-
108-
return 0
109-
}).map(item => `/${ folder }/${ item }`)
110-
}
111-
112-
function resolveNumeric(value) {
113-
const sub = value.substring(0, value.indexOf('.'))
114-
115-
const num = Number(sub)
116-
117-
return isNaN(num) ? value : num
118-
}
120+
})

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
"url": "git+ssh://[email protected]/TheDragonCode/laravel-actions.git"
1818
},
1919
"devDependencies": {
20-
"@vuepress/plugin-theme-data": "2.0.0-rc.8",
20+
"@vuepress/bundler-vite": "^2.0.0-rc.8",
21+
"@vuepress/theme-default": "^2.0.0-rc.20",
2122
"@vueuse/core": "^7.5.5",
2223
"dotenv": "^15.0.0",
23-
"vuepress": "2.0.0-rc.8"
24+
"vuepress": "^2.0.0-rc.8"
2425
},
2526
"engines": {
26-
"node": ">=16.16"
27+
"node": ">=20.11"
2728
}
2829
}

0 commit comments

Comments
 (0)