PromptingTools.jl icon indicating copy to clipboard operation
PromptingTools.jl copied to clipboard

Update to DocumenterVitepress v0.2.x

Open asinghvi17 opened this issue 7 months ago • 2 comments

This will also need the symlink folders on gh-pages to be purged. Here's a function that will do that for you:

function remove_symlinks_from_gh_pages(repo_url::String; branch::String = "gh-pages")

           function success_or_error(cmd, msg = "Error running command `$(cmd)`")
               out = IOBuffer()
               err = IOBuffer()
               result = run(pipeline(cmd; stdout = out, stderr = err))
               if result.exitcode != 0
                   message = message * "\n\nStdout: $(String(take!(out)))" * "\n\nStderr: $(String(take!(err)))"
                   error(message)
               end
           end

           # Clone the repo and switch to `gh-pages`
           mktempdir() do dir
               success_or_error(
                   `git clone --branch $(branch) --single-branch --depth 1  $repo_url $dir`,
                   "Failed to clone the repository at $(repo_url). Please check the repository URL and try again."
               )
               symlinks = filter(islink, readdir(dir; join = true))
               isempty(symlinks) && return
               @info "Removing symlinks" symlinks
               foreach(rm, symlinks)

               cd(dir) do
                   success_or_error(
                       `git stage -A`,
                       "Failed to stage the changes. Please check the repository and try again."
                   )
                   success_or_error(
                       `git commit -m "Remove symlinks from gh-pages"`,
                       "Failed to commit the changes. Please check the repository and try again."
                   )
                   success_or_error(
                       `git push origin $(branch)`,
                       "Failed to push the changes. Please check the repository and try again."
                   )
               end
           end
       end

asinghvi17 avatar May 14 '25 23:05 asinghvi17

wow! thank you so much!! I'll review and merge over the weekend :-)

svilupp avatar May 15 '25 20:05 svilupp

No worries! Actually, might want to hold off on that. We will have one more major change (hopefully not breaking) over the weekend I think...could do the change now but it would be better (and more extensible) to do it after that.

asinghvi17 avatar May 15 '25 20:05 asinghvi17