Conversation
That way instead of manually duplicating code, we can just run `cargo test` to generate them.
|
I assume we probably also wanna commit the generated bindings so that we can keep track of them (and might even be required for build to succeed). @Alystrasz thoughts? |
TypeScript binding autogenerated from Rust code
TypeScript binding autogenerated from Rust code
|
Aight, the only thing missing is Given that I could use this PR for #139 (otherwise I'll have even more duplicated definitions), I'd just merge what we hav here and keep |
|
Added docs as well now ^^ Now it should be done for real :P |
using `ts-rs` as done in #140
We want to avoid people modifying TS bindings instead of Rust classes (despite your documentation saying not to :)) |
Uh, I don't quite see where I tell the reader to modify them. I just tell them how to (re-)generate the bindings if changes to the corresponding Rust class were made. Or am I misunderstanding something? ^^
We can create them just before building by simply running AFAIK it is possible to only run certain unit tests but the way Therefore the best approach is probably to check in CI if running Question is, do I have to do this in this PR still or can I just make a TODO issue and do it in the next PR? ^^" |
Nah, documentation tells developers to edit Rust classes, and not bindings.
Can we integrate bindings generation in the file watcher (i.e. if you update a Rust class while running
We already have a bunch of issues, let's do this here :) |
File watcher stuff is handled by Tauri. I'm not aware of a way to hook that to add a call to a custom function on file change. And even then as soon as we start doing unit testing, it would mean that all unit tests are re-run the moment any time the developer presses save on a file. That's a lot of additional compute needed that not everyone has (e.g. me when working on FlightCore on my puny laptop :P) |
Welp, guess I have to figure out how to actually do this in CI then ^^" |
Checks for uncommitted binding changes in CI and fails if they differ
Turns out using ChatGPT this was actually easier than I anticipated. Anyway done with 49c454a now. Also did a few test runs to ensure that it fails if binding changes are not committed ^^ |
|
To add some more context to this PR, I did some more research into TypeScript interfaces generated from Rust. Compared to
Hence I'd argue that |
|
And as for generating bindings, I'd argue that committing generated bindings is the way to go as otherwise TypeScript linting will fail until running |
Alystrasz
left a comment
There was a problem hiding this comment.
I'm unsure about committing bindings to repo, maybe I'll rework that later.
* feat: Initial backend code to get list of PRs Hardcoded for launcher right now * refactor: Autogen TS bindings from Rust code using `ts-rs` as done in #140 * fix: Fix incorrect typing What is returned is actually an array of `PullsApiResponseElement` * feat: Prototyping frontend UI for installing PR * fix: Use right repo Used Mods instead of Launcher * feat: Enable installing launcher pull request * refactor: Rename variables to indicate approp repo NorthstarLauncher vs NorthstarMods * style: Formatting fixes * feat: Initial code for getting mods PRs * feat: Add backend code for installing mods PRs * feat: Add note about launching in notification * fix: Remove commented out code * refactor: Depduplicate code * refactor: Remove unnecessary use of anyhow * refactor: Use already existing function for checking game path * feat: Add comment about profile / batch file * chore: Remove leftover print statements * feat: Add clickable link for each PR * refactor: Reduce duplicate code * refactor: Rename enum * fix: Use proper type * fix: Remove leftover `console.log`s * style: Revert accidental formatting change * refactor: Remove second API call for mods PRs * refactor: Rename variable * refactor: Remove second API call for launcher PRs * refactor: Move API URL string to `constants.rs` So that all constants are in a single place * fix: Restore lines deleted in merge * style: Formatting fixes * fix: Print line when done installing PR * feat: Show notification for install start/done Displays a notification that PR install has started and upon completion replaces it with one saying that install has completed. * fix: Remove left-over console log * feat: "Install PR" UI (#197) * refactor: export pull requests selector to dedicated component * refactor: regroup launcher+mods collapses in one collapse component * refactor: load pull requests when opening selector collapse item * refactor: review progress loaders' style * fix: don't fetch PRs if they've already been loaded * feat: update collapse style * refactor: remove fetch success notification * refactor: both collapses can be opened at the same time * fix: non-accordion collapse sends an object as event parameter * fix: Iterate over multiple pages of GitHub CI API This ensures we can still grab older artifacts. Max page is capped at 10 as going too high will cause us to hit API rate limits. Also refined error message accordingly. * refactor: Move stored PRs to submodule as suggested in review * refactor: Move getPullRequests to store submodule I order to clean up PullRequestSelector.vue Other functions will follow in separate commits. Currently TypeScript compilation fails on undefined type of `state` * fix: Properly define state type * refactor: Move installLauncherPR to store submodule * refactor: Move installModsPR to store submodule --------- Co-authored-by: Rémy Raes <contact@remyraes.com>
That way instead of manually duplicating code, we can just run
cargo testto generate them using ts-rs.Closes #126