@@ -29,10 +29,15 @@ function alfredMatcher(str) {
29
29
async function run ( ) {
30
30
const docsPages = [ ] ;
31
31
const officialDocsURL = "https://help.obsidian.md/" ;
32
- const officialDocsJSON = await getOnlineJson (
33
- "https://api.github.com/repos/obsidianmd/obsidian-docs/git/trees/master?recursive=1" ,
34
- ) ;
35
32
const rawGitHubURL = "https://raw.githubusercontent.com/obsidianmd/obsidian-docs/master/" ;
33
+ const officialDocsTree = "https://api.github.com/repositories/285425357/git/trees/master?recursive=1" ;
34
+
35
+ // GUARD
36
+ const officialDocsJSON = await getOnlineJson ( officialDocsTree ) ;
37
+ if ( ! officialDocsJSON ) {
38
+ console . error ( "Could not fetch json from: " , officialDocsTree ) ;
39
+ process . exit ( 1 ) ;
40
+ }
36
41
37
42
// OFFICIAL DOCS
38
43
const officialDocs = officialDocsJSON . tree . filter (
@@ -46,6 +51,7 @@ async function run() {
46
51
const area = doc . path . split ( "/" ) . slice ( 1 , - 1 ) . join ( "/" ) ;
47
52
const url = officialDocsURL + doc . path . slice ( 3 , - 3 ) . replaceAll ( " " , "+" ) ;
48
53
const title = ( doc . path . split ( "/" ) . pop ( ) || "error" ) . slice ( 0 , - 3 ) ;
54
+ console . info ( "Indexing: " , title ) ;
49
55
50
56
docsPages . push ( {
51
57
title : title ,
@@ -84,6 +90,7 @@ async function run() {
84
90
cache : { seconds : 60 * 60 * 24 * 7 , loosereload : true } ,
85
91
} ;
86
92
93
+ if ( ! fs . existsSync ( "./.github/caches/" ) ) fs . mkdirSync ( "./.github/caches/" , { recursive : true } ) ;
87
94
const beautifiedForBetterDiff = JSON . stringify ( docsJson , null , 2 ) ;
88
95
fs . writeFileSync ( "./.github/caches/obsidian-help-index.json" , beautifiedForBetterDiff ) ;
89
96
}
0 commit comments