File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 2020 BRANCH_NAME=$(echo $BRANCH | sed 's|origin/||')
2121 if [[ $BRANCH_NAME == ver/* ]]; then
2222 VER=$(echo $BRANCH_NAME | sed 's|build/ver/||')
23- echo sed -i "s/BASE_INJECT_POINT/${VER}/g" ./docs/.vitepress/config.mts > replace.sh
24- chmod +x replace.sh
25- ./replace.sh
26- rm replace.sh
23+ echo ${VER} > VER
2724 fi
2825
2926 - name : Setup Node.js
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import {withI18n} from 'vitepress-i18n';
55import { VitePressI18nOptions } from 'vitepress-i18n/dist/types' ;
66import { VitePressSidebarOptions , withSidebar } from "vitepress-sidebar" ;
77import { tabsPlugin } from "./theme/tabs/codesMarkdownPlugin" ;
8+ import fs from "fs" ;
89
910const defaultLocale : string = 'en' ;
1011const supportLocales : string [ ] = [ defaultLocale , 'zhHans' ] ;
@@ -31,7 +32,7 @@ const vitepressOptions: UserConfig = {
3132 rewrites : {
3233 'en/:rest*' : ':rest*'
3334 } ,
34- base : 'BASE_INJECT_POINT' ,
35+ base : getBase ( ) ,
3536 vite : {
3637 optimizeDeps : {
3738 exclude : [
@@ -139,4 +140,12 @@ const vitepressSidebarOptions = [
139140 } )
140141] ;
141142
143+ function getBase ( ) : string {
144+ if ( fs . existsSync ( "VER" ) ) {
145+ return `/${ fs . readFileSync ( "VER" , 'utf8' ) } /` ;
146+ } else {
147+ return '' ;
148+ }
149+ }
150+
142151export default defineConfig ( withSidebar ( withI18n ( vitepressOptions , vitePressI18nOptions ) , vitepressSidebarOptions ) )
Original file line number Diff line number Diff line change 1313 "@nolebase/vitepress-plugin-enhanced-readabilities" : " ^2.10.0" ,
1414 "@types/markdown-it" : " ^14.1.2" ,
1515 "@types/markdown-it-container" : " ^2.0.10" ,
16+ "fs" : " ^0.0.1-security" ,
1617 "markdown-it" : " ^14.1.0" ,
1718 "markdown-it-container" : " ^4.0.0" ,
1819 "markdown-it-mathjax3" : " ^4.3.2" ,
You can’t perform that action at this time.
0 commit comments