Which is the better/idiomatic way to call npm before building a Rust application?
I have tried using the build.rs approach, but it is not called every time, but just only when something changes in my Rust code (instead when my web app code changes), furthermore it is not showing the npm output clearly (using -vv is making it showing lot of information that are hiding more interesting ones).
I am looking for something that it is always called at the beginning of each build and stops the build in case of any issues showing errors. I would like to avoid bash/Python script (for portability or introduction of extra dependencies).
You need to tell cargo that your npm invocation, and thus your build.rs execution, depend on non-Rust files, by emitting special rerun-if-changed=path/to/webapp/file commands inside your build.rs script; see the documentation.