diff --git a/.vscode/settings.json b/.vscode/settings.json index 1c68f97cc..0967ef424 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1 @@ -{ - "rust-analyzer.inlayHints.enable": true -} +{} diff --git a/Cargo.toml b/Cargo.toml index 99d6ff539..71bcbfc4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "dioxus-studio" version = "0.1.0" -authors = ["Jonathan Kelley "] +authors = ["Jonathan Kelley"] edition = "2018" description = "CLI tool for developing, testing, and publishing Dioxus apps" "license" = "MIT/Apache-2.0" @@ -14,25 +14,22 @@ log = "0.4.13" fern = { version = "0.6.0", features = ["colored"] } wasm-bindgen-cli-support = "0.2.78" anyhow = "1.0.38" -argh = "0.1.4" -serde = "1.0.120" -serde_json = "1.0.61" -async-std = { version = "1.9.0", features = ["attributes"] } -tide = "0.16.0" -fs_extra = "1.2.0" +serde = "1" +serde_json = "1" + +fs_extra = "1.2.0" cargo_toml = "0.10.0" futures = "0.3.12" notify = "5.0.0-pre.4" -rjdebounce = "0.2.1" -tempfile = "3.2.0" html_parser = "0.6.2" - -tui = { version = "0.15.0", features = ["crossterm"] } -crossterm = "0.19.0" -tui-template = { git = "https://github.com/jkelleyrtp/tui-builder.git" } +tui = { version = "0.16.0", features = ["crossterm"] } +crossterm = "0.22.1" +binary-install = "0.0.2" +convert_case = "0.5.0" +structopt = "0.3.25" +cargo_metadata = "0.14.1" [[bin]] - path = "src/main.rs" name = "dioxus" diff --git a/TODO.md b/TODO.md new file mode 100644 index 000000000..6fd51d591 --- /dev/null +++ b/TODO.md @@ -0,0 +1,11 @@ + +asd +- [ ] use a TUI for the dev server aspect of things +- [ ] allow any index.html +- [ ] use wasmopt for production builds +- [ ] pass arguments through to `cargo` +- [ ] figure out a bundling strategy +- [ ] an external configuration + + +should we just use trunk? diff --git a/src/builder.rs b/src/builder.rs index 83a6d1de5..96317beb2 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -3,26 +3,13 @@ use crate::{ config::{CrateConfig, ExecutableType}, error::{Error, Result}, }; -use log::{info, warn}; use std::{ io::{Read, Write}, process::Command, }; use wasm_bindgen_cli_support::Bindgen; -pub struct BuildConfig {} -impl Into for BuildOptions { - fn into(self) -> BuildConfig { - BuildConfig {} - } -} -impl Default for BuildConfig { - fn default() -> Self { - Self {} - } -} - -pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { +pub fn build(config: &CrateConfig) -> Result<()> { /* [1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?) [2] Generate the appropriate build folders @@ -43,7 +30,7 @@ pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { let t_start = std::time::Instant::now(); // [1] Build the .wasm module - info!("Running build commands..."); + log::info!("Running build commands..."); let mut cmd = Command::new("cargo"); cmd.current_dir(&crate_dir) .arg("build") @@ -66,7 +53,7 @@ pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { let output = child.wait()?; if output.success() { - info!("Build complete!"); + log::info!("Build complete!"); } else { log::error!("Build failed!"); let mut reason = String::new(); @@ -87,12 +74,10 @@ pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { let input_path = match executable { ExecutableType::Binary(name) | ExecutableType::Lib(name) => target_dir - // .join("wasm32-unknown-unknown/release") .join(format!("wasm32-unknown-unknown/{}", release_type)) .join(format!("{}.wasm", name)), ExecutableType::Example(name) => target_dir - // .join("wasm32-unknown-unknown/release/examples") .join(format!("wasm32-unknown-unknown/{}/examples", release_type)) .join(format!("{}.wasm", name)), }; @@ -113,7 +98,7 @@ pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { // [5] Generate the html file with the module name // TODO: support names via options - info!("Writing to '{:#?}' directory...", out_dir); + log::info!("Writing to '{:#?}' directory...", out_dir); let mut file = std::fs::File::create(out_dir.join("index.html"))?; file.write_all(gen_page("./wasm/module.js").as_str().as_bytes())?; @@ -121,7 +106,7 @@ pub fn build(config: &CrateConfig, _build_config: &BuildConfig) -> Result<()> { match fs_extra::dir::copy(static_dir, out_dir, ©_options) { Ok(_) => {} Err(_e) => { - warn!("Error copying dir"); + log::warn!("Error copying dir"); } } @@ -139,7 +124,7 @@ fn gen_page(module: &str) -> String { -
+