Yew CLI development PR#1419
Conversation
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
There was a problem hiding this comment.
I think editor setup shouldn't be commited to the repo. Would you mind adding this to the .gitignore?
| rayon = "1.3.1" | ||
| lazy_static = "1.4.0" | ||
| log = "0.4.11" | ||
| clap = "2.33.1" No newline at end of file |
There was a problem hiding this comment.
I think these can be a little less specific (I know IntelliJ tends to fill in with the most specific possible) because of how semantic versioning works. e.g.
| clap = "2.33.1" | |
| clap = "2.33" |
|
|
||
| use log::{error, info, warn}; | ||
|
|
||
| // Usages: |
There was a problem hiding this comment.
These would be better as doc comments attached to the main function.
/// content ...
fn main() { ... }| .about("compiles a Yew application") | ||
| .arg( | ||
| Arg::with_name("run") | ||
| .help("Start a webserver for the built project and open it in a browser window") |
There was a problem hiding this comment.
| .help("Start a webserver for the built project and open it in a browser window") | |
| .help("Start a web server for the built project and open it in a browser window") |
| .short("r") | ||
| ) | ||
| .arg( | ||
| Arg::with_name("release") |
There was a problem hiding this comment.
I think this could be better handled by taking everything after -- and passing it to cargo (like how cargo allows you to pass arguments to rustc, e.g. cargo test -- --nocapture where --nocapture is passed to rustc).
|
@teymour-aldridge All valid comments. It should be noted though, this is a draft PR and still very WIP so we probably won’t really be ready for a review for a number of iterations. :-) |
|
@philip-peterson I realise that :P – I'm just making one or two suggestions here for future development before the work is done rather than afterwards (to minimise wasted effort). |
|
Fair enough! It is helpful feedback to have, will give another shout when things are farther along. Thanks for the initial feedback 🙏 |
# Conflicts: # yew-cli/Cargo.toml # yew-cli/src/main.rs
|
How far along are we with this? I'm seeing some rather surprising things in here like Now that we have #1504 for the internal maintenance tasks we no longer need this to take care of them. The CLI stands completely on its own now so I would like to give it its own repository in the yewstack organisation. What do you think, @jstarry? |
|
The goal of yew-config was to solve the following problem: we want users to be able to run all the examples at once, and that means compiling them and starting a web server for each. However we can’t specify whether each example is wasm-bindgen or wasm-pack on a per-example basis, as that would require a flag for each example, negating the convenience of starting all examples at one time. (We can currently only specify the build scheme for all projects across the board, however, some examples use wasm-pack and others don’t.) Because of this, we really wanted a per-project config standard so that each project could specify whether it wants wasm-pack or not, as well as maybe some settings like route structures for SSG/SSR down the line. Yew-config allows the user to specify a configuration on each project, using normal Rust typing mechanisms instead of ad-hoc unspecified dynamic config files a la Webpack. The configs will be read by the yew-cli tool before starting up the web servers for the examples. I do think it’s a tad unrelated and can be merged as its own PR first, but it’s still a requirement for that feature of yew-cli. |
|
I love that it's possible to run all examples at once but I don't think that's something we were really missing :) I also really like the idea of having a config for Yew projects but to be brutally honest I don't like the idea of having the configuration in the actual Rust code which even adds an additional dependency to the project. I'm willing to change my mind on this if you can point me to a project that uses this approach successfully but right now I'm very much in favour of a simple Why are we distinguishing between I think yew-cli should behave like a fork of |
|
Wasm-pack requires that there be a function annotation As for yew-config, that's pretty disappointing to hear .. I would prefer not to be the person to introduce yet another untyped, schema-less config to the web development ecosystem. Would sooner vote to just remove the ability to run all examples at once. I really think we'll need yew-config at some point soon, especially if we want to run the yew-router examples which each have their own independent lists of routes that correspond to the index.html. We can kick the can down the road for now by not including it but I expect it will come up eventually. |
There are a few differences I didn't mention because they are mostly surface-level and only exist because
Yes, I absolutely agree. |
|
I'm a bit skeptical of that plan, wouldn't it be better to have wasm-pack own support for this? wasm-pack looks like a pretty large surface area to maintain, and I'm not really sure what we would gain from forking it. |
That would make some sense, but I doubt the maintainers of
Well, what's the alternative then? If we use |
|
They would probably rather support the feature than have us fork their library and split the ecosystem. We should at least ask IMO. But, also I would posit that we don’t exactly need to have this — we already invoke wasm-pack with success, it’s just not ideal because of the annotation and cargo dependency. MVP for yew-cli at least doesn’t require a wasm-pack fork for now. |
|
I wouldn't really call it "splitting the ecosystem" if the tools serve two distinct purposes but I admit that it doesn't hurt to ask first.
Just to make this clear: I'm not advocating for creating a fork of wasm-pack to be used by yew-cli. I'm saying yew-cli should be the fork of wasm-pack. Anyway, I think it's fine to have yew-cli call out to wasm-pack for the test command for now but I would rather we didn't use it for the build command because then we'd either have to drop support for raw wasm-bindgen or have it conform to the standards set by wasm-pack otherwise we would end up splitting the ecosystem. |
|
I’m confused. Why would supporting wasm-pack require dropping support for wasm-bindgen? We already support both. |
@philip-peterson Because examples that are setup as binaries (rather than libraries) and use Personally, I think that I do agree with @siku2 that this PR is not the right place for that exploration. I would prefer if this was moved to a separate non-yewstack repo (like many other yew libraries) and developed independently. In the future, I expect some of the independent libraries will become first class members of the yew monorepo. The best the Yew maintainers can do is help the community discover and collaborate on these libraries while they are still in their infancy. I'm going to close this PR due to this being the wrong place for this type of exploration. Please feel free to open a PR that would add links to a new |
Description
This is a PR for tracking the development of Yew CLI