Fix frontend install mix task bug
[akkoma] / lib / mix / tasks / pleroma / frontend.ex
index c385c355a38a2c38902d19758b73012f6f2b9d20..0a48be1fe978c54176d683dba86a14f301236233 100644 (file)
@@ -9,7 +9,7 @@ defmodule Mix.Tasks.Pleroma.Frontend do
 
   @shortdoc "Manages bundled Pleroma frontends"
 
-  @moduledoc File.read!("docs/administration/CLI_tasks/frontend.md")
+  @moduledoc File.read!("docs/administration/CLI_tasks/frontend.md")
 
   def run(["install", "none" | _args]) do
     shell_info("Skipping frontend installation because none was requested")
@@ -69,7 +69,7 @@ defmodule Mix.Tasks.Pleroma.Frontend do
 
     fe_label = "#{frontend} (#{ref})"
 
-    tmp_dir = Path.join(dest, "tmp")
+    tmp_dir = Path.join([instance_static_dir, "frontends", "tmp"])
 
     with {_, :ok} <-
            {:download_or_unzip, download_or_unzip(frontend_info, tmp_dir, options[:file])},
@@ -133,6 +133,7 @@ defmodule Mix.Tasks.Pleroma.Frontend do
 
   defp install_frontend(frontend_info, source, dest) do
     from = frontend_info["build_dir"] || "dist"
+    File.rm_rf!(dest)
     File.mkdir_p!(dest)
     File.cp_r!(Path.join([source, from]), dest)
     :ok