@@ -2,29 +2,63 @@ import fs from 'fs'
22import path from 'path'
33import 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
79dotenv . 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+
943const 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+ } )
0 commit comments