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

Add trunk template alongside current template for web #44

Closed
yusdacra opened this issue Jan 16, 2022 · 5 comments · Fixed by #65 or #69
Closed

Add trunk template alongside current template for web #44

yusdacra opened this issue Jan 16, 2022 · 5 comments · Fixed by #65 or #69

Comments

@yusdacra
Copy link

yusdacra commented Jan 16, 2022

trunk (https://trunkrs.dev/) is a complete build driver for wasm / web. It is very easy to use and has good defaults, and can easily be configured. I believe instead of using bash scripts and whatnot, it would be better to use trunk so that it's simpler to deploy and work with.

My suggestion would be to keep the scripts, but add a separate branch (or folder?) showing how it looks with trunk. Essentially it's just a simple index.html file at the root of the repository (which trunk uses to configure the build with), as seen like here.

@yusdacra yusdacra changed the title Use trunk instead of bash scripts for web Add trunk template alongside current template for web Jan 16, 2022
@emilk
Copy link
Owner

emilk commented Jan 17, 2022

That sounds like a good idea! Would you like to contribute it?

@yusdacra
Copy link
Author

Sure! I can go with the branch approach and link that in the README.md, which should be okay I think.

@emilk
Copy link
Owner

emilk commented Jan 19, 2022

I think a separate folder is better first step (easier to keep up-to-date). If it works well, we can maybe switch it to be the default :)

@coderedart
Copy link
Contributor

so, i tried doing this https://github.com/coderedart/eframe_template .

it was pretty easy to do.

most of the work is in https://github.com/coderedart/eframe_template/commit/b25fc179130da765e6cdee8f2bc29bd219e33373 commit. just needed to add the copy commands, comment out the custom wasm_bindgen stuff from index.html, add the start function to main.rs and finally set the favicon (in another commit).

I added a separate pages.yml to automate the publishing to github pages part.

  1. I set the tags as the trigger, but personally, i would just use the push as trigger to keep the live version up to date with the master branch. i will leave this decision to you on what triggers to use.
  2. I use a separate branch for the live build instead of building and committing the latest live build in docs/ folder. I felt there's no point in actually committing the temporary builds of js / wasm to git history of the source repo itself.
  3. live build link: https://coderedart.github.io/eframe_template/
  4. I also use rust-cache action to cache the rust artefacts. when you are often just fixing tiny little things in commits, there's no point in recompiling from scratch :)
  5. the most important part is that even if it is not used, i think providing a commented out version will be useful for people who want to use this. this workflow stuff (especially with wasm) is not easy to setup. speaking as a newbie that had to mess around for an hour to figure out that i needed to use --public-url option with github repo name or trunk can't set the relative paths right

anyway, i accidentally clicked use template button instead of fork, so i will need to make a new PR anyway. just wanted to know if any changes are required before i start the PR (or if anyone else wants to take this and add more stuff).

@coderedart
Copy link
Contributor

coderedart commented Jul 17, 2022

forgot to mention that trunk uses /dist folder and not docs by default to build the website and i added it to .gitignore as that's what most people would do.

EDIT: even if the workflow runs, you must also go to github repo -> settings -> pages -> source -> set to branch : gh-pages + /(root) as source and click on save. only after that will pages-build-deployment action will run (everytime there's a push to gh-pages by our pages.yaml workflow) and deploy the latest files to servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants