From d11f64486fcf487c14c0e21d4548c90d936f73d0 Mon Sep 17 00:00:00 2001 From: Ormoyo Date: Tue, 9 Apr 2024 15:33:09 +0300 Subject: [PATCH] Add dioxus bau --- lua/compiler/bau/dioxus.lua | 20 ++++++++++++++++++++ lua/compiler/utils-bau.lua | 17 +++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lua/compiler/bau/dioxus.lua diff --git a/lua/compiler/bau/dioxus.lua b/lua/compiler/bau/dioxus.lua new file mode 100644 index 00000000..e12874ad --- /dev/null +++ b/lua/compiler/bau/dioxus.lua @@ -0,0 +1,20 @@ +--- Dioxus bau actions + +local M = {} + +-- Backend - overseer tasks performed on option selected +function M.action(_) + local overseer = require("overseer") + local final_message = "--task finished--" + local task = overseer.new_task({ + name = "- Dioxus runner", + strategy = { "orchestrator", + tasks = {{ "shell", name = "- Build and run Dioxus ", + cmd = "dx serve --hot-reload" .. -- run + " && echo '" .. final_message .. "'" + },},},}) + task:start() + vim.cmd("OverseerOpen") +end + +return M diff --git a/lua/compiler/utils-bau.lua b/lua/compiler/utils-bau.lua index 101e7017..959924b7 100644 --- a/lua/compiler/utils-bau.lua +++ b/lua/compiler/utils-bau.lua @@ -253,6 +253,18 @@ local function get_nodejs_opts(path) return options end +local function get_dioxus_opts(path) + local options = {} + + local file = io.open(path, "r") + + -- Just adds an option to build with dioxus cli + if file then + table.insert(options, { text = "Build Dioxus", value = "placeholder", bau = "dioxus" }) + end + + return options +end -- FRONTEND -- Public functions to call from the frontend. @@ -291,6 +303,11 @@ function M.get_bau_opts() working_dir .. utils.os_path("/package.json") )) + -- dioxus + vim.list_extend(options, get_dioxus_opts( + working_dir .. utils.os_path("/Dioxus.toml") + )) + return options end