CADmium-Co / CADmium

A CAD program that runs in the browser
https://cadmium-co.github.io/CADmium/
Other
1.35k stars 51 forks source link

Feat(build): Bundle native application using Tauri #92

Closed jbcpollak closed 4 weeks ago

jbcpollak commented 1 month ago

This uses Tauri to build a native app. Its based on Rust and having had experience with Electron, this seems way smoother. I picked the beta version (v2) because it is adding support for mobile platforms, although I haven't gotten that far yet. This is another strength because the alternative would be something bonkers like Electron for desktop and Ionic for mobile and then it would be a complete mess.

All in all, I'm pretty shocked at how easy this was.

Pre-Reqs

Notable Changes

Other than that, this is all new functionality, the core code didn't change beyond the above.

Usage

Testing

Tested

(dev, binary and install)

Untested

TODO

av8ta commented 1 month ago

image

Awesome!

Do you know if tauri apps can accept input from stdin?

dzervas commented 1 month ago

Can we add a build:tauri command to the root package.json? I imagine we don't want to build tauri by default (same for dev)

EDIT: Sorry just realized that neither build nor dev build tauri, only pnpm tauri build do that

av8ta commented 1 month ago

@jbcpollak agree that using the cadmium icons would be good and getting all the dependencies sorted in the devcontainer is a good idea too.

Also, updating readme to suit. I found I had to come here for build instructions, and like @dzervas I was looking for a package.json script to kick it off for me!

Awesome work btw. Works great on my machine :)

jbcpollak commented 1 month ago

@dzervas @av8ta - thanks for the feedback, I'll work on those things!

av8ta commented 4 weeks ago

Hey just realised we'll need a solution for the base url as well. We're using github pages atm and pretty happy with it.

jbcpollak commented 4 weeks ago

hum, I'll look into that, been a while since I've used GitHub pages - pretty sure we can figure that out

jbcpollak commented 4 weeks ago

Hey just realised we'll need a solution for the base url as well. We're using github pages atm and pretty happy with it.

@av8ta - so I looked at this for a bit and I think it will be fine. I will try and setup the action to run on my fork and verify first but here's my thinking:

the app URL is https://cadmium-co.github.io/CADmium/, and index.html (and all assets) are deployed to the CADmium/ directory on the server.

Currently index.html has absolute paths like this:

<link rel="apple-touch-icon" sizes="180x180" href="/CADmium/assets/apple-touch-icon-DDWPlyIz.png">

this PR changes the URLs to relative resolution:

<link rel="apple-touch-icon" sizes="180x180" href="./assets/apple-touch-icon-DDWPlyIz.png">

since we still load .../CADmium/index.html relative resolution will be .../CADmium/./<whatever>.

so pretty sure its 👍 , but I'll double check if I can get actions running on my fork

jbcpollak commented 4 weeks ago

Confirmed, you can see it working with relative paths here: https://code.joshpollak.com/CADmium/

jbcpollak commented 4 weeks ago

Also MacOS works fine:

Screenshot 2024-06-05 at 10 43 03 PM
jbcpollak commented 4 weeks ago

I've added icons and updated the readme.

About the dependencies in the devcontainer - to install the GUI libraries takes a ton of space, and in the interest of making the devcontainer light and accessible, I'm sort of inclined not to install the dependencies. Especially in the on-create.sh where they can't be cached as a Docker layer, but even if they could be, I feel like they are best left out of that environment.

It can be done though, I'm just not sure who and how many people are using the devcontainer and I don't want to be disruptive to them.

Thoughts?

av8ta commented 4 weeks ago

Not a biggie to leave the deps out of devcontainer for now. So long as folks can develop with the devcontainer in the browser that should be fine.

jbcpollak commented 4 weeks ago

🎉