@@ -21,14 +21,13 @@ const processDocItem = (item, parentPath = "", language = "en") => {
2121 const basePath = path . join ( docsPath , language , "guide" , "docs" , parentPath , folderName ) ;
2222
2323 // 生成 _meta.json
24- if ( children && children . length > 0 ) {
25- const metaPath = path . join ( path . join ( docsPath , language , "guide" , "docs" , parentPath ) , "_meta.json" ) ;
26- if ( ! fs . existsSync ( metaPath ) ) {
27- writeFile ( metaPath , JSON . stringify ( [ ] , null , 2 ) ) ;
28- }
29-
30- const metaJson = JSON . parse ( readFile ( metaPath ) ) ;
24+ const metaPath = path . join ( path . join ( docsPath , language , "guide" , "docs" , parentPath ) , "_meta.json" ) ;
25+ if ( ! fs . existsSync ( metaPath ) ) {
26+ writeFile ( metaPath , JSON . stringify ( [ ] , null , 2 ) ) ;
27+ }
28+ const metaJson = JSON . parse ( readFile ( metaPath ) ) ;
3129
30+ if ( children ) {
3231 metaJson . push ( {
3332 type : "dir" ,
3433 name : folderName ,
@@ -38,13 +37,6 @@ const processDocItem = (item, parentPath = "", language = "en") => {
3837 } ) ;
3938 writeFile ( metaPath , JSON . stringify ( metaJson , null , 2 ) ) ;
4039 } else {
41- const metaPath = path . join ( path . join ( docsPath , language , "guide" , "docs" , parentPath ) , "_meta.json" ) ;
42- if ( ! fs . existsSync ( metaPath ) ) {
43- writeFile ( metaPath , JSON . stringify ( [ ] , null , 2 ) ) ;
44- }
45-
46- const metaJson = JSON . parse ( readFile ( metaPath ) ) ;
47-
4840 metaJson . push ( {
4941 type : "file" ,
5042 name : folderName ,
0 commit comments