Closed siku2 closed 4 years ago
While we are tackling this with #1419, just for the sake of discussion I'd like to throw out the idea of using rhai for some of the simpler tasks. https://docs.rs/rhai/0.17.0/rhai/ Rhai is a rust-based scripting language that has a slightly different syntax but shares many of the same ideas and is more lightweight than Rust, plus installable via Cargo. It's not necessarily ready for prime time, but worth looking into (IMO) if someone has spare time.
Maybe I misunderstood the intention of the issue. But it sounds as if the build script for yew when you work on it should not depend on a certain scripting language hence the os specific scripting language but something like https://github.com/sagiegurari/cargo-make to automate ci and help with setup of new devs? This could be relevant as apparently frontend devs are interested in the framework as well and are used to the npm script tools with you can automate some tedious tasks. yew cli I would understand as a tool to get started quicker to work on a yew based project to utilize framework more easily. So one is a tool for users and the other a feature to make it easier for contributors to get started.
I haven't had the chance to use cargo-make
yet, is it mature enough to handle more complex tasks?
yew cli I would understand as a tool to get started quicker to work on a yew based project to utilize framework more easily. So one is a tool for users and the other a feature to make it easier for contributors to get started.
Yes, that's what I had in mind as well. Separate tools for different purposes.
If cargo-make is capable of handling the task it would make for a much better developer experience than having to compile an entire CLI first.
I haven't had the chance to use cargo-make yet, is it mature enough to handle more complex tasks?
@siku2 it seems pretty stable for whatever in Rust can be considered stable :) that's the official repository https://github.com/sagiegurari/cargo-make . I haven't had the chance to use cargo-make yet either. But judging by the number of features and length of documentation it seems pretty solid.
just saw this issue and wanted to say that i would be more than happy to help out if needed. with cargo make you can break those scripts to tasks and sub tasks and create flows.
anything too complex to define declaratively as a task can be scripted with any scripting language you want (including bash) and have a different script implementation per OS (optional). however, cargo-make does come with an embedded bash like scripting language called duckscript which is really really simple and since its built in rust, it supports all major OS (including max, linux and windows). But in general, scripts should only be used if you can't really declare the tasks as simple commands and flows.
@sagiegurari, really appreciate the offer! I'm pretty much convinced at this point that cargo-make would make a great fit for Yew. Usually, I prefer the simplicity of "Just" but cargo-make is much more cross-platform friendly and seems more ambitious in terms of scope. For the past week or so I've been reading into the documentation but I haven't had the chance to sit down and actually implement it.
@siku2 i started a draft PR to show how to migrate, i'll probably continue it for more scripts. tell me if it makes sense or not? i started with run_stable_checks.sh
Proposal
Currently Yew uses a number of bash scripts for various maintenance tasks. Examples include the
run_stable_checks.sh
andexamples/build.sh
scripts. This is problematic for Windows contributors who either don't have bash installed or don't know that they do (for example through git). The scripts might also depend on executables that aren't typically found in a Windows environment.The solution proposed here is to create a command line tool for the Yew repository that takes care of running tests, building and running the examples, and other tasks.
We should use a generic name like
tools
to avoid confusion in case we create ayew
cli for developers in the future. To run the CLI one would usecargo run -p tools -- <args>
.The following table shows the most relevant commands:
example <name>
check
test <crate>
test --all
It should be much easier than with bash to make these commands user-friendly.
Rejected Alternatives
cmd.exe
) makes it harder to update a script in the future as the changes would need to be reflected in both versions.By using Rust we don't require contributors to install any dependencies and since they're familiar with the language it should be easier to maintain.
References
Related Issues:
1368
Relevant Links:
aspell
from Rust: https://github.com/lise-henry/rust-ispell