Skip to content

Commit

Permalink
Merge pull request #151 from TheDragonCode/4.x
Browse files Browse the repository at this point in the history
Upgrade Vuepress
  • Loading branch information
andrey-helldar authored Mar 14, 2024
2 parents 085479f + ef160e0 commit 2dd27c1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 44 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Cache dependencies
uses: actions/cache@v4
Expand Down
84 changes: 43 additions & 41 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,63 @@ import fs from 'fs'
import path from 'path'
import dotenv from 'dotenv'

import { defaultTheme, viteBundler } from 'vuepress'
import {viteBundler} from '@vuepress/bundler-vite'
import {defaultTheme} from '@vuepress/theme-default'
import {defineUserConfig} from 'vuepress'

dotenv.config()

function getChildren(folder, sort = 'asc') {
const extension = ['.md']
const names = ['index.md', 'readme.md']

const dir = `${__dirname}/../${folder}`

return fs
.readdirSync(path.join(dir))
.filter(item =>
fs.statSync(path.join(dir, item)).isFile() &&
!names.includes(item.toLowerCase()) &&
extension.includes(path.extname(item))
)
.sort((a, b) => {
a = resolveNumeric(a)
b = resolveNumeric(b)

if (a < b) return sort === 'asc' ? -1 : 1
if (a > b) return sort === 'asc' ? 1 : -1

return 0
}).map(item => `/${folder}/${item}`)
}

function resolveNumeric(value) {
const sub = value.substring(0, value.indexOf('.'))

const num = Number(sub)

return isNaN(num) ? value : num
}

const hostname = 'actions.dragon-code.pro'

module.exports = {
export default defineUserConfig({
bundler: viteBundler(),

lang: 'en-US',
title: 'Dragon Code: Actions',
description: 'Performing actions with saving the list of called files',

head: [
['link', { rel: 'icon', href: `https://${ hostname }/images/logo.svg` }],
['meta', { name: 'twitter:image', content: `https://${ hostname }/images/logo.svg` }]
['link', {rel: 'icon', href: `https://${hostname}/images/logo.svg`}],
['meta', {name: 'twitter:image', content: `https://${hostname}/images/logo.svg`}]
],

bundler: viteBundler(),

theme: defaultTheme({
hostname,
base: '/',

logo: `https://${ hostname }/images/logo.svg`,
logo: `https://${hostname}/images/logo.svg`,

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

navbar: [
{ text: '4.x', link: '/prologue/changelog/4.x.md' }
{text: '4.x', link: '/prologue/changelog/4.x.md'}
],

sidebarDepth: 1,
Expand Down Expand Up @@ -83,36 +117,4 @@ module.exports = {
}
]
})
}

function getChildren(folder, sort = 'asc') {
const extension = ['.md']
const names = ['index.md', 'readme.md']

const dir = `${ __dirname }/../${ folder }`

return fs
.readdirSync(path.join(dir))
.filter(item =>
fs.statSync(path.join(dir, item)).isFile() &&
! names.includes(item.toLowerCase()) &&
extension.includes(path.extname(item))
)
.sort((a, b) => {
a = resolveNumeric(a)
b = resolveNumeric(b)

if (a < b) return sort === 'asc' ? -1 : 1
if (a > b) return sort === 'asc' ? 1 : -1

return 0
}).map(item => `/${ folder }/${ item }`)
}

function resolveNumeric(value) {
const sub = value.substring(0, value.indexOf('.'))

const num = Number(sub)

return isNaN(num) ? value : num
}
})
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
"url": "git+ssh://git@github.com/TheDragonCode/laravel-actions.git"
},
"devDependencies": {
"@vuepress/plugin-theme-data": "2.0.0-rc.8",
"@vuepress/bundler-vite": "^2.0.0-rc.8",
"@vuepress/theme-default": "^2.0.0-rc.20",
"@vueuse/core": "^7.5.5",
"dotenv": "^15.0.0",
"vuepress": "2.0.0-rc.8"
"vuepress": "^2.0.0-rc.8"
},
"engines": {
"node": ">=16.16"
"node": ">=20.11"
}
}

0 comments on commit 2dd27c1

Please sign in to comment.