-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add trunk
template alongside current template for web
#65
Conversation
.github/workflows/pages.yml
Outdated
- name: Build # build | ||
run: ./trunk build --release --public-url eframe_template # change this name to your project name | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to document that to enable docs, you first need to go to
github repo -> settings -> pages -> source -> set to gh-pages
branch + /
root folder to deploy them.
might seem obvious, but not for noobs like me :)
https://coderedart.github.io/eframe_template/ for live example
.github/workflows/pages.yml
Outdated
- name: Downlaod and Install Trunk binary | ||
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | ||
- name: Build # build | ||
run: ./trunk build --release --public-url eframe_template # change this name to your project name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./trunk build --release --public-url eframe_template
using --public-url something
will allow trunk to modify all the href paths like from favicon.ico
to something/favicon.ico
. this is necessary for github pages where the site is deployed to username.github.io/something
and all files must be requested relatively as something/favicon.ico
.
i have seen some people also use a "hack" by sed
replacing all paths to use relative paths instead like ./favicon.ico
after trunk build step. this is used when you don't know which url your project is going to be deployed to. but trunk dev has recommended against it on discord, and idk enough about this to argue
index.html
Outdated
<head> | ||
<title>eframe template</title> | ||
<!-- the files we need to copy into the dist folder to make them available for web server --> | ||
<link data-trunk rel="copy-file" href="docs/favicon.ico"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can replace all of these with a single
<link data-trunk rel="copy-dir" href="docs">
and use href="docs/favicon.ico"
as the paths. but idk if some of these files need to be at root folder, so i will ignore this for now.
index.html
Outdated
<!-- The WASM code will resize the canvas dynamically --> | ||
<!-- the id is hardcoded in main.rs . so, make sure both match. --> | ||
<canvas id="the_canvas_id"></canvas> | ||
<!-- <div class="centered" id="center_text"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots of commented code that idk what to do with. safe to ignore i think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code is dead code and should be removed
don't know how to link issues with PRs, so just commenting to link the issue. |
it seems the whole action to deploy to was able to fix this by using relative path instead. |
trunk
template alongside current template for web
should be good now. added small tips to README |
@emilk is there anything else that needs to be done? |
This is a completely different way of building and deploying the app, and as such, I wonder if it wouldn't make more sense to have this at its own repository (e.g. at |
I assumed that after a while the old way of building would be removed and just stick to trunk. Otherwise, as you said, it doesn't make sense to have two ways of doing the same thing. can always have a new separate template repository if you want to keep this repo clean. |
How about this: we remove all the old way of building/deploying web in this PR too. It will then be more clear to me what are the benefits and drawback of I'd like to publish new builds manually. I have currently only published new WASM binaries when I've updated the eframe/egui version, and I'd like to keep it that way to keep the size of the git repository down (since any large binary file commited to a git repo will forever be part of its history). Though I appreciate having the instructions for how to do automatic deploys in the new PS: I very much appreciate you working on this, as do I appreciate your patience with my slow reviews and inconsistent position 😆 |
on:
release:
types: [published]
There's a difference though. until now, we committed the wasm binaries to the https://stackoverflow.com/questions/2613903/does-deleting-a-branch-in-git-remove-it-from-the-history
one more cool thing i just discovered. from the docs of the deploy action
if we don't want to bother explicitly cleaning the |
Ah very cool @coderedart, especially with the |
@emilk cleaned it up. one nice thing would be to update the this is the live build. no errors README could be polished a little bit too i guess. |
I tried my best to rebase, but the pull request still says that there's conflicts :( |
You seem to have rebased their I tried what a proper rebase would do (like, suppose you have For the future, I think in this case it would have been much better to perform a merge instead of a rebase. It makes it possible to see what happened in parallel and which conflicts have been resolved. When merging the pull request, it can always still be squashed if there are too many small commits. |
making a new pull request. i will learn git, but not today xD |
@coderedart there is a problem. Since emilk/egui#2107 I opened this |
^ Trunk should be considered a binary, not a library. You will not call trunk. It runs independently of your code, and hence, should not pose any restrictions on how your code or application is structured. |
There's a work-around in #83 |
Closes #44
So, these are the changes roughly.
index.html
at crate root. for trunk.main.rs
forwasm32
target instead of using manual start function in library..github/pages.yml
enables users to see their latest egui app live on gh-pages branch. can change trigger totags
to only deploy for releases.Trunk.toml
to make sure that build artefacts (js/wasm) always have the same name forsw.js
caching..gitignore
. well, don't want devs to accidentally commit the dist folder which is used for builds by trunk.