Reading about Rust from the perspective of a web dev is cute — like in a really wholesome, sweet, enlightening way.
“Also, as a language, Rust does a lot of type casting.”
“Cargo also has a concept of “feature flags” defined at the dependency level. (The closest analogy I can come up with is using npm to access a module’s internals or import a named submodule…”
I love Svelte. I always bring out this comparison between create-react-app and svelte’s sveltejs/template:
After a fresh app from create-react-app:
$ npm install
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
[...]
added 1810 packages from 736 contributors and audited 1813 packages in 68.426s
145 packages are looking for funding
run `npm fund` for details
found 3 moderate severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
$ du -h node_modules/ | tail -n 1
229M node_modules/
After a fresh app from the Svelte template:
$ npm install
added 96 packages from 126 contributors and audited 97 packages in 2.922s
6 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ du -h node_modules/ | tail -n 1
21M node_modules/
One of those seems like a fairly neat system which I can understand, keep up to date with software updates, and take responsibility for as the dependencies for my application. The other seems completely unmanagable to me. I know that React isn’t just adding dependencies for the hell of it, I know it probably has a lot more features than Svelte. But… I say “probably” because I honestly haven’t ran into any features I miss yet, Svelte seems completely up to the task of building the kinds of web apps I need it to. And the development experience is really nice, with .vue files, automatic recompilation, a really fast compiler, live reloading, …
You can write semantic HTML in React too though, I don’t understand this complaint. The reason why React devs only use divs so much is simply that they don’t bother learning/using semantic HTML.
I don’t remember having any issues getting React to mount on an element that is not <div> or mount a tree that doesn’t start with a <div>. It used to give a warning (it still might, I haven’t checked) if you tried to mount the app directly on <body> because external libraries often append and delete elements from <body>, which might cause a conflict with React if the whole tree is rerendered, but other than that you can use whatever element you want as root/mount point.
As a React user I took one look at create-react-app and decided never to touch it (for exactly the reason you highlighted). React isn’t create-react-app though. React itself is very small and you really really don’t need create-react-app.
How well do they work on other *NIX platforms? I’m always a bit nervous of things that are based on web technologies for GUI apps because they seem to abruptly break as soon as the deployment platform is anything other than Linux/Windows/macOS (in a large part because Google refuses to accept Chromium patches for any minority OS unless it’s one that they own). One of the ones that was featured on Lobste.rs a while ago had a GTK WebView-based UI. The code for it was portable to any GTK/POSIX platform (no Linux-specific stuff), but was guarded by #ifdef __linux__.
Short answer: the venerable Tauri.
woooooah, how have I not heard of Tauri before? Thank you!
Reading about Rust from the perspective of a web dev is cute — like in a really wholesome, sweet, enlightening way.
“Also, as a language, Rust does a lot of type casting.”
“Cargo also has a concept of “feature flags” defined at the dependency level. (The closest analogy I can come up with is using npm to access a module’s internals or import a named submodule…”
Svelte and Tauri, some of my favorite projects on the front page of Lobsters? Nice.
I’ve built node-webkit, nwjs, and Electron apps. Tauri is best in class.
I love Svelte. I always bring out this comparison between
create-react-app
and svelte’ssveltejs/template
:After a fresh app from
create-react-app
:After a fresh app from the Svelte template:
One of those seems like a fairly neat system which I can understand, keep up to date with software updates, and take responsibility for as the dependencies for my application. The other seems completely unmanagable to me. I know that React isn’t just adding dependencies for the hell of it, I know it probably has a lot more features than Svelte. But… I say “probably” because I honestly haven’t ran into any features I miss yet, Svelte seems completely up to the task of building the kinds of web apps I need it to. And the development experience is really nice, with .vue files, automatic recompilation, a really fast compiler, live reloading, …
With Svelte you can’t go wrong. Aside from complexity and whatnot of React, one of the things that irritates me the most is all. The damn.
<div>
s!“Hey bro I heard you liked
<div>
s so we’re gonna put<div>
s inside your<div>
s!”With Svelte I can write semantic HTML and ensure the output is that way too.
You can write semantic HTML in React too though, I don’t understand this complaint. The reason why React devs only use divs so much is simply that they don’t bother learning/using semantic HTML.
Last I checked (which admittedly hasn’t been in a while), it was an uphill battle to get my React app to get started in an element that was not
<div>
.I don’t remember having any issues getting React to mount on an element that is not
<div>
or mount a tree that doesn’t start with a<div>
. It used to give a warning (it still might, I haven’t checked) if you tried to mount the app directly on<body>
because external libraries often append and delete elements from<body>
, which might cause a conflict with React if the whole tree is rerendered, but other than that you can use whatever element you want as root/mount point.This has never been a problem as far as I know (been using it since version 0.8), save for the warning about
<body>
elements that @steinull mentions.As a React user I took one look at
create-react-app
and decided never to touch it (for exactly the reason you highlighted). React isn’tcreate-react-app
though. React itself is very small and you really really don’t needcreate-react-app
.Oh wow, that’s news to me!
How well do they work on other *NIX platforms? I’m always a bit nervous of things that are based on web technologies for GUI apps because they seem to abruptly break as soon as the deployment platform is anything other than Linux/Windows/macOS (in a large part because Google refuses to accept Chromium patches for any minority OS unless it’s one that they own). One of the ones that was featured on Lobste.rs a while ago had a GTK WebView-based UI. The code for it was portable to any GTK/POSIX platform (no Linux-specific stuff), but was guarded by
#ifdef __linux__
.I honestly don’t know but their Discord is super helpful and responsive.