Skip to content

Add dioxus build utility #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lua/compiler/bau/dioxus.lua
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions lua/compiler/utils-bau.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand Down