@@ -44,9 +44,28 @@ func updateBranch(cloneURL, branch string, silent bool) {
4444 }
4545 }
4646
47- // Run the retype build command
48- cmd := exec .Command ("retype" , "build" )
49- cmd .Dir = repoBranchPath
47+ // Check if this is a docusaurus build
48+ isDocusaurus := false
49+ if _ , err := os .Stat (fmt .Sprintf ("%s/docusaurus.config.ts" , repoBranchPath )); err == nil {
50+ isDocusaurus = true
51+ }
52+
53+ // Set up the command
54+ var cmd * exec.Cmd
55+ if isDocusaurus {
56+ // Install dependencies
57+ cmd = exec .Command ("npm" , "install" )
58+ cmd .Dir = repoBranchPath
59+ _ = cmd .Run ()
60+
61+ // Run the actual build
62+ cmd = exec .Command ("npm" , "run" , "build" )
63+ cmd .Dir = repoBranchPath
64+ } else {
65+ // It's a Retype site. Run that instead
66+ cmd = exec .Command ("retype" , "build" )
67+ cmd .Dir = repoBranchPath
68+ }
5069
5170 // Set up logging for the command output
5271 var out , stderr bytes.Buffer
@@ -55,7 +74,7 @@ func updateBranch(cloneURL, branch string, silent bool) {
5574
5675 if err := cmd .Run (); err != nil {
5776 // Log the error and output (both stdout and stderr)
58- logMessage ("Retype build failed for branch %s: %v" , branch , err )
77+ logMessage ("Build failed for branch %s: %v" , branch , err )
5978 logMessage ("Stdout: %s" , out .String ())
6079 logMessage ("Stderr: %s" , stderr .String ())
6180
@@ -75,7 +94,15 @@ func updateBranch(cloneURL, branch string, silent bool) {
7594 // Remove old HTML folder, and copy the new one
7695 os .RemoveAll (htmlBranchPath )
7796 os .MkdirAll (htmlBranchPath , os .ModePerm )
78- exec .Command ("cp" , "-r" , fmt .Sprintf ("%s/.retype/." , repoBranchPath ), htmlBranchPath ).Run ()
97+
98+ // Copy the output files
99+ var copyCmd * exec.Cmd
100+ if isDocusaurus {
101+ copyCmd = exec .Command ("cp" , "-r" , fmt .Sprintf ("%s/build/." , repoBranchPath ), htmlBranchPath )
102+ } else {
103+ copyCmd = exec .Command ("cp" , "-r" , fmt .Sprintf ("%s/.retype/." , repoBranchPath ), htmlBranchPath )
104+ }
105+ _ = copyCmd .Run ()
79106
80107 // Send final notification to discord
81108 logMessage ("Successfully built and updated branch: %s" , branch )
@@ -85,7 +112,7 @@ func updateBranch(cloneURL, branch string, silent bool) {
85112 }
86113}
87114
88- // Branch was deleted, so we delete the output folder
115+ // The Branch was deleted, so we delete the output folder
89116func deleteBranch (branch string ) {
90117 htmlBranchPath := fmt .Sprintf ("%s/%s" , htmlPath , branch )
91118
@@ -139,7 +166,7 @@ func initializeBranches() {
139166 return
140167 }
141168
142- // For each branch, check if it exists in the html folder. If not, update it
169+ // For each branch, check if it exists in the HTML folder. If not, update it
143170 for _ , branch := range branches {
144171 if ! branchFolderExists (branch ) {
145172 logMessage ("Found missing branch: %s. Building..." , branch )
0 commit comments