File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed
Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 88 required : false
99 type : string
1010 default : ' docs'
11+ vitepress-path :
12+ description : ' Path to the .vitepress directory (e.g. ".vitepress" or "docs/.vitepress")'
13+ required : false
14+ type : string
15+ default : ' .vitepress'
1116 enable-toc-check :
1217 description : ' Enable TOC link validation (requires .vitepress/toc_*.json)'
1318 required : false
6974 uses : actions/checkout@v6
7075
7176 - name : Validate config.js syntax
72- run : node --check .vitepress/config.js
77+ run : node --check "${{ inputs .vitepress-path }} /config.js"
7378
7479 json-lint :
7580 name : Validate JSON Files
8287 - name : Validate JSON syntax
8388 run : |
8489 shopt -s nullglob
85- files=(.vitepress/toc_*.json)
90+ files=("${{ inputs .vitepress-path }}" /toc_*.json)
8691 if [ ${#files[@]} -eq 0 ]; then
87- echo "No .vitepress/toc_*.json files found"
92+ echo "No ${{ inputs .vitepress-path }} /toc_*.json files found"
8893 exit 1
8994 fi
9095 for file in "${files[@]}"; do
@@ -113,7 +118,7 @@ jobs:
113118 docs-validation/check-toc-links.cjs
114119
115120 - name : Check TOC links exist
116- run : node .docs-tools/docs-validation/check-toc-links.cjs
121+ run : node .docs-tools/docs-validation/check-toc-links.cjs --vitepress-path "${{ inputs.vitepress-path }}" --docs-path "${{ inputs.docs-path }}"
117122
118123 markdown-lint :
119124 name : Lint Markdown
Original file line number Diff line number Diff line change @@ -59,7 +59,19 @@ function getLangFromTocFile(tocFile) {
5959 * Main validation function
6060 */
6161function validateTocFiles ( ) {
62- const tocFiles = fs . readdirSync ( ".vitepress" ) . filter ( ( f ) => f . match ( / ^ t o c _ .* \. j s o n $ / ) ) . map ( ( f ) => `.vitepress/${ f } ` ) ;
62+ const args = process . argv . slice ( 2 ) ;
63+ let vitepressPath = ".vitepress" ;
64+ let docsBasePath = "docs" ;
65+
66+ for ( let i = 0 ; i < args . length ; i ++ ) {
67+ if ( args [ i ] === "--vitepress-path" && i + 1 < args . length ) {
68+ vitepressPath = args [ ++ i ] ;
69+ } else if ( args [ i ] === "--docs-path" && i + 1 < args . length ) {
70+ docsBasePath = args [ ++ i ] ;
71+ }
72+ }
73+
74+ const tocFiles = fs . readdirSync ( vitepressPath ) . filter ( ( f ) => f . match ( / ^ t o c _ .* \. j s o n $ / ) ) . map ( ( f ) => path . join ( vitepressPath , f ) ) ;
6375
6476 if ( tocFiles . length === 0 ) {
6577 console . error ( "No toc_*.json files found" ) ;
@@ -75,7 +87,7 @@ function validateTocFiles() {
7587 continue ;
7688 }
7789
78- const docsDir = path . join ( "docs" , lang ) ;
90+ const docsDir = path . join ( docsBasePath , lang ) ;
7991 if ( ! fs . existsSync ( docsDir ) ) {
8092 console . error ( `Docs directory not found: ${ docsDir } ` ) ;
8193 hasErrors = true ;
You can’t perform that action at this time.
0 commit comments