#Custom template

25 messages · Page 1 of 1 (latest)

wheat sentinel
#

👋 naive me with naive question again
I'm looking at the folder structure scafolding of js based and cargo based template (i check pnpm / yew / leptos / sycamore) with mobile added
it look more or less like this simplified version:

-proj-name/
  |--src/
     |--main.[rs/js/ts]
  |--src-tauri/
     |--gen/
        |--android/
     |--src/
        |--main.[rs/js/ts]
     |--build.rs
     |--Cargo.toml
  |
  |--package.json    <== actual tauri cli entry `pnpm/cargo/... tauro android dev`
  |--index.html  <== I'm guessing what's used to inject the WebView

how easy is it to change that scaffolding around ?
trying to toy with dotnet WASM around and basically dotnet works with .csproj which would be close to what that package.json or maybe cargo.toml + trunk.toml at the same time
that csproj is generally within the same folder as source files, ie: no sub src/ folder
most of the time dotnet repo have multiple "csproj" in fact like when you try to do code splitting which would be the equivalent of multiple library + one app in the same "git repo" each library would be it own csproj and the app (WASM here) as well

the JS equivalent is generally mentionned as "npm workspace mono repo" (even though i don't like the use of mono repo for that)

is there anything that should absolutly not be changed that tauri impose ?

I'm trying to wrap my head on something that would look like this (maybe / drafting it):

-proj-name/
  |--dotnet-src/
     |--foo.sln  // SLN file are made to load the entire dotnet workspace in IDE
     |--src/
        |--bar/  // WASM PROJECT HERE --- this product static assets / wasm ....
        |--kix/  // LIB GOES HERE
     |--test/
        |--bar.tests/
        |--kix.test/
  |--src-tauri/
     |--gen/
        |--android/
     |--src/
        |--main.[rs/js/ts]
     |--build.rs
     |--Cargo.toml

unsure where goes the index.html but i'm pretty sure it's generated by the dotnet scaffolding as well

I'm also not sure if the sln file shouldn't be at root level
but sadly dotnet run which is literally the equivalent of pnpm dev cannot "run" a solution (a solution is just about scaffolding)
the app is what's running, so dotnet run is to target a specific csproj either by being in the folder or a huge long ass dotnet run --project ./path/to/csproj/file/or/folder

#

another alternative would look like:

-proj-name/
  |--src/
     |--bar/  // WASM PROJECT HERE --- this product static assets / wasm ....
     |--kix/  // LIB GOES HERE
     |--src-tauri/
        |--gen/
           |--android/
        |--src/
           |--main.[rs/js/ts]
        |--build.rs
        |--Cargo.toml
  |--test/
     |--bar.tests/
     |--kix.test/
  |--foo.sln  // SLN file are made to load the entire dotnet workspace in IDE
violet wigeon
# wheat sentinel 👋 naive me with naive question again I'm looking at the folder structure scafol...
  1. The src-tauri folder can be called whatever you want, it's literally a Rust crate, so name it tauri-src to stick your dotnet naming scheme
  2. Only put .sln at the top level if you intend to make the entire monorepo Visual Studio based, if not then keep it in the dotnet folder. I personally wouldn't put it at the top because I would never consider Visual Studio and .Net my top level stuff
  3. Putting different frameworks together like this is usually done by making your own custom little CLI tool and doing what the Tauri CLI does, namely call out to cargo build and the Android build tools in order to build stuff, then move stuff around manually in the code to where things should be. So you'd make a CLI of some sort that runs the build for .Net, then probably move the WASM to the Tauri project, trigger building, then maybe move some build artifact somewhere else
  4. In src-tauri/src there's absolutely no question about the file ending, it's always .rs, never .js or .ts in there, it's a Rust project
wheat sentinel
#

i think on poitn 4. is was a copy pasta from the src/ folder ... dunno why i did that

#

(i'll be re-reading all that slowly in a few moment, thx a lot for taking time here)

#

I'll have to read the 2 links you sent me with that regarding the way process communicates

violet wigeon
wheat sentinel
#

my possible other quesiton might be related to
how/where I'm supposed to setup the index.html for tauri to be used in the webview, and it's probably documented, I yet ahvent digged

wheat sentinel
#

the dotnet code will likely generate a WASM and a small subset of JS (rutime boostrapping mostly)

#

unsure if there's specific to know about doing that setup

violet wigeon
violet wigeon
wheat sentinel
#

somehow sounds either than what I expected

#

dotnet blazor is "trying" to have wasm HotReload support, i wonder how far that is if I can stick to their output folder
though i have no fucking faith in their tooling, mostly relying on "use VS, by VS, per VS, in VS ... nop no debugger for ya"

violet wigeon
wheat sentinel
violet wigeon
wheat sentinel
#

trunk is the static file server used by Yew I assume ?

violet wigeon
#

Used by most Rust WASM frameworks actually

wheat sentinel
#

yeah so like express

violet wigeon
#

More like Vite/Webpack

wheat sentinel
#

oO ok