Closed MartinKavik closed 4 years ago
Related issue from Seed repo to 6. Auto-reload: https://github.com/David-OConnor/seed/issues/172.
I was looking at source code for microserver
(we use it for starting examples in Seed and serve
task here) - and it seems quite simple. And we have nice examples server-integration
and websocket
in Seed repo.
So this is the idea: Write a simple alternative for microserver
. New server will serve wasm files + assets like microserver
but it will have also REST (?) API for invoking page reload. That API would be called by watcher after build (Variant A). Or this new server would have own watcher instead of API and it would monitor served files for changes (Variant B).
This server will send command to reload to served client through websocket. Client receives commands either through injected javascript by server (Variant X) or through Rust connector (Variant Y) - there will be something like this in client code:
#[wasm_bindgen(start)]
#[cfg(debug_assertions)]
connect_to_live_reload_server();
pub fn render() {
seed::App::build(|_, _| Model::default(), update, view)
.finish()
.run();
}
Some of the Makefile issues are cleaned up in the latest commit.
Do you think fmt and clippy makefile tasks are needed in this repo? Ie functionality past what running cargo clippy
and cargo fmt
provide?
Imho it's nice to have default strict settings and if somebody don't like it, it's always faster to delete it than write new one. Also for new rust users it's better to use cargo make * because it automatically installs required dependencies.
On Mon, 29 Jul 2019 at 09:42, David-OConnor notifications@github.com wrote:
Do you think fmt and clippy makefile tasks are needed in this repo? Ie functionality past what running cargo clippy and cargo fmt provide?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/David-OConnor/seed-quickstart/issues/11?email_source=notifications&email_token=AENI3GSDSDXF3WKDUWHLBTDQB2NNXA5CNFSM4IHHSE2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD273Z4Q#issuecomment-515882226, or mute the thread https://github.com/notifications/unsubscribe-auth/AENI3GSRAN4W3X6Y2OCAOQTQB2NNXANCNFSM4IHHSE2A .
with cargo make watch
, would there be a solution somewhere in this notion?
while [ ! cargo make build ] ; do
block until change is detected
end while
cargo make watch
@Ben-PH Maybe.. I plan to update this quickstart and then move to Seeder and use Seeder as the primary Seed/Rust app template. Then you'll have space for experiments with this quickstart, I don't want to invest a lot of time into it.
The quickstart rewritten and updated. Some of the features from the list above have been implemented. However some advanced features will be integrated into more advanced quickstart/tool Seeder. I think this QS should be as simple as possible.
RealWorld example is based on this quickstart, so I want to write a list of changes / missing features before I forget:
Makefile.toml
doesn't make sense in quickstart's context (e.g. "Run Seed's tests. Ex:..").clippy
,fmt
,verify
,verify_only
, ..rustfmt.toml
,.travis.yml
and maybenetlify.toml
.wasm-bindgen-test
is missing indev-dependencies
.cargo make watch
builds before starting watcher so its annoying if you have more compilation errors and want to start watcher for easier debugging.*.wasm
size (it's possible to strip several hundred of KBs):opt-level
should bes
orz
).wasm-pack
. Or it can be probably installed withcargo-make
. I'm using NodeJS API wrapper - see this script inseed-quickstart-webpack
.