-
Notifications
You must be signed in to change notification settings - Fork 3
Answering questions #48
Comments
Oh! Those were mostly questions and remarks I had in my brain while writing https://github.com/fstephany/fullstack
Yep, that's my feeling as well. It's probably super hard to find a nice balance between feature and configuration. I think most of my questions are maybe the result of a mismatch between our respective goals. You are focused on the frontend/wasm part while I'm trying to handle all the pieces (backend+frontend+css) with wasm-run in the fullstack example. |
Thanks to you. I really want to see this project getting better. I believe it has great potential. But I won't be sad if it turns out to be useless/a bad idea.
I think we should debate a lot more on that because I believe it is the source of our misunderstandings on this project. So if you don't mind I will challenge here your ideas and develop mine better. If you do the same, hopefully we will reach a better understanding and a common vision.
This is definitely true. I built wasm-run almost based on wasm-pack. I didn't have a focus at all on the backend. Though I've figured it would be extremely useful so the backend+frontend scenario has been added on a later stage of this project.
This is because in the real world the backend and the frontend are rarely served together. The frontend is usually served by a content delivery service while the backend is running on a container or a vm somewhere. Therefore you rarely deliver backend+frontend together. You usually deliver them separately. I consider the CSS part of the frontend. I don't even imagine "css build" as I don't see a use for this. Except for designers maybe... but this is out of our usage. That is why the "serve" and "build" commands always build and serve the css. (Maybe I should consider it more)
Nevertheless. This was my own vision but I would like you to challenge it. The better the critics, the better the product. |
As usual, I think we agree on almost everything but we put it differently into words 😅
Yep. The only time when it makes sense to have all of them together is during development.
I agree as well. For the first point, that's where I think it would be useful to have a sensible default that will work for the 2 (or 3 depending how we count CSS) components. When working with a project like fullstack, I would imagine the following flow when I develop: (general idea)
This would start 3 watchers. One for the WASM frontend, one for the backend code and one for the sass. As you said it is possible to do that now with the custom hooks but a default mechanism could be useful. We would then have pre/post_build hooks for all the components (frontend, backend and sass). We could generalize this with something like When come the time to build for production, I fully agree with you that the backend should be built as a separate entity. |
This is done by the feature
I think we agree just on that but not on the way to do it. 🤔 In the current settings, you need to add an entrypoint for the backend so the But after looking at |
But I'm not fond of the Why don't we consider the three components like separate entities in development and provide the plumbing to hook them together when generating a release build? The use case of pure frontend development could be handled like it is now ie., a minimalistic tide add that serve the generated files while developing. |
I already answered this in the ticket in web-bundler. There would be the use cases:
(If you don't mind I think we should continue the conversation there. panoptix-za/web-bundler#6) |
cc @fstephany
The doc string for build and serve are duplicated and wrong. There is already a ticket for it: #39
pre_build
,post_build
are pretty obvious on their own.watch
is to change the watching behavior, it's not linked to an order of execution.serve
is to change the serving behavior, again it's not particularly linked to an order.run_server
is to change the behavior when theserve
feature is disabled. Theserve
feature provide a small HTTP server to serve the files. Without it, you need to configure your own server.default_build_path
is to override the default build path, it's not related to an order of execution either.other_cli_commands
is to handle the other (not build or serve) cli commands, it's not related to an order of execution though I think it should be the very first thing executedThis is an example of custom command that builds a Docker image https://github.com/IMI-eRnD-Be/wasm-run/blob/main/examples/backend-and-frontend/frontend/src/main.rs#L11
wasm-run
builds the frontend so it rebuilds only the frontend components by default.You can use the
full-restart
feature to trigger a full rebuild (backend and anything else). It's done in the example: https://github.com/IMI-eRnD-Be/wasm-run/blob/main/examples/backend-and-frontend/frontend/Cargo.toml#L16There is no way to rebuild only the backend as
wasm-run
is not intended to assist backend development but frontend development (or the interactions between the two as a whole).Yes. Everything* is watched by default.
wasm-run
intend is to assist frontend development as a whole.Yes if you override post_build you need to setup your own sass/scss generation. It isn't additive because it's a one-size-fit-all by default hook configuration which you can entirely override if you wish.
We could provide a separate "css" hook. It's an idea.
You can't prevent it without overriding the post_build hook. We could add a flag to customize that in particular... I think the problem we have here in general is that there are too many things in the post_build hook and it makes it cumbersome when you only want to override one small behavior.
Yes, you can totally change that the way you want by overriding
post_build
. I personally do that to embed the JS in theindex.html
.Anyhow is useful for binaries. It's an opinionated and pragmatic choice as you usually don't want to make error enums in script that just build the frontend.
The text was updated successfully, but these errors were encountered: