Skip to content
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

Document dioxus.toml configuration values (bundling, various private/undocumented fields) #1474

Open
tigerros opened this issue Sep 19, 2023 · 3 comments · May be fixed by DioxusLabs/docsite#123
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@tigerros
Copy link

tigerros commented Sep 19, 2023

Specific Demand

There's some values in the Dioxus.toml which aren't documented on the website or even the source code itself. I looked in the 0.3.0 book as well, and they don't seem to be there either. It seems strange to me that these would be undocumented, but I guess that's the case.

Additionally, it would be great if there was a way to generate an example Dioxus.toml that would contain all possible values. This would allow us to replace the dioxuslabs.com configuring page with a link to the docs.rs, thus reducing the amount of documentation we need to maintain.

Implement Suggestion

Initially, I wanted to document them myself, but realized it's difficult seeing as I didn't write it, and I only have experience with the web configuration (which is documented). However, I've got some suggestions.

The config structs are in cli/src/config.rs. The documentation for some of them is on the dioxuslabs.com configuring page, so that can be copied. Other documentation needs to be added though.

As for generating the example, we could use something like this:

// [dependencies]
// serde = { version = "1.0.0", features = ["derive"] }
// toml = "0.8.0"

use serde::{Serialize, Deserialize};

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct BundleConfig {
    // other fields...
    pub identifier: Option<String>,
    // Why is "icon" a vector? Shouldn't it be "icons"?
    pub icon: Option<Vec<String>>,
    pub resources: Option<Vec<String>>,
    // other fields...
}

// Maybe in a post-build cargo-make?
fn main() {
    // I don't really know what these fields refer to, so these example values might be wrong
    let example_bundle = BundleConfig {
        identifier: Some("GitHub".to_string()),
        icon: Some(vec!["assets/favicon.ico".to_string()]),
        resources: Some(vec!["assets/*".to_string(), "octocat_images/*".to_string()]),
    };

    match toml::to_string_pretty(&example_bundle) {
        Ok(toml_str) => println!("{toml_str}"),
        Err(_) => println!("Failed to generate example"), // Or panic
    }
}

Output:

identifier = "GitHub"        
icon = ["assets/favicon.ico"]
resources = [
    "assets/*",
    "octocat_images/*",
]
@ealmloff
Copy link
Member

ealmloff commented Sep 19, 2023

Bundler settings are copied from tauri-bundle (more docs here). (The only reason we don't use tauri's structs directly is because tauri's structs don't implement serialize and deserialize which we need to convert them to and from toml)

@ealmloff ealmloff added the documentation Improvements or additions to documentation label Sep 19, 2023
@tigerros
Copy link
Author

tigerros commented Sep 19, 2023

Bundler settings are copied from tauri-bundle (more docs here)

That explains it. I suppose linking the tauri docs would be sufficient then. Also, does the TUI use the tauri bundler, or only desktop and mobile? For the docsite.

@ealmloff
Copy link
Member

ealmloff commented Sep 19, 2023

Bundler settings are copied from tauri-bundle (more docs here)

That explains it. I suppose linking the tauri docs would be sufficient then. Also, does the TUI use the tauri bundler, or only desktop and mobile? For the docsite.

I think it should work for TUI, but I haven't tested it. Mobile cannot use dx bundle yet

@jkelleyrtp jkelleyrtp changed the title Document configuration values Document dioxus.toml configuration values Jul 25, 2024
@jkelleyrtp jkelleyrtp changed the title Document dioxus.toml configuration values Document dioxus.toml configuration values (bundling, various private/undocumented fields) Jul 25, 2024
@jkelleyrtp jkelleyrtp added this to the 0.6.0 milestone Jul 25, 2024
@jkelleyrtp jkelleyrtp self-assigned this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants