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

Use Rust for the front-end too #374

Merged
merged 11 commits into from
Dec 25, 2018
Merged

Use Rust for the front-end too #374

merged 11 commits into from
Dec 25, 2018

Conversation

elegaanz
Copy link
Member

Rust can compile to WASM, so let's use it for front-end code as well.

To compile the front-end:

cargo install cargo-web
cd plume-front
cargo web deploy -o ../static

Rust is transpiled to WASM and loaded with a JS file from Cargo web
@elegaanz elegaanz added C: Enhancement New feature or request A: Front-End Related to the front-end S: Ready for review This PR is ready to be reviewed labels Dec 23, 2018
Copy link
Contributor

@trinity-1686a trinity-1686a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a hard time testing this. I think it would be better to cargo web deploy without location, and do some processing (adding static/ to path so the new route is not required) and copying by ourselves in build.rs. Currently the instructions are polluting static/ with an index.html

@@ -0,0 +1,572 @@
"use strict";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file souldn't be committed, it's auto generated and things like __cargo_web_snippet_199d5eb25dfe761687bcd487578eb7e636bd9650 are probably not reproducible between builds

@elegaanz
Copy link
Member Author

You can now just use cargo web deploy, build.rs will do the rest.

@igalic
Copy link
Contributor

igalic commented Dec 24, 2018

how much faster is the resulting wasm compared to the previous Javascript?

@trinity-1686a
Copy link
Contributor

@igalic considering our use-case, probably not much. The main advantage is the whole team being able to debug it I think

@elegaanz
Copy link
Member Author

There may be better performances once with the future editor, especially when writing big articles. Another advantage is that we will be able to share code between backend and frontend if we need it.

@trinity-1686a
Copy link
Contributor

@BaptisteGelez I see Travis failed because of cargo-web installation, you might be interested into this https://github.com/koute/cargo-web#using-cargo-web-on-travis .

@codecov
Copy link

codecov bot commented Dec 24, 2018

Codecov Report

Merging #374 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #374   +/-   ##
=======================================
  Coverage   27.86%   27.86%           
=======================================
  Files          63       63           
  Lines        6280     6280           
=======================================
  Hits         1750     1750           
  Misses       4530     4530

trinity-1686a
trinity-1686a previously approved these changes Dec 24, 2018
Copy link
Contributor

@trinity-1686a trinity-1686a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also update documentation, something like add "run cargo web deploy -p plume-front"

.gitignore Outdated Show resolved Hide resolved
@elegaanz elegaanz merged commit 3fce5d6 into master Dec 25, 2018
@elegaanz elegaanz deleted the wasm branch December 25, 2018 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: Front-End Related to the front-end C: Enhancement New feature or request S: Ready for review This PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants