It's clear what your point is. There was no need to explain. You want to put your thumb on the scale and confirm your biases.
> The actual file is 42 lines there
Okay? If you encounter an argument "There exists an X", proving it wrong is not as trivial as pointing out "I can show there (also) exists a Y".
I wrote what I wrote for a reason. Write such a hello world program in a mainstream idiomatic style that most closely resembles the way a JS programmer would write, and a GTK hello world app is (shocker!)... 12 SLOC, as mentioned:
$ ls -l ./scratch/hello.js # written yesterday
-rwxrwxr-x 1 asmithee asmithee 402 Nov 20 13:54 ./scratch/hello.js
$ cloc ./scratch/hello.js | \
> grep -ie javascript | \
> sed "s/ \( \+[0-9]\+\)\{3,3\}/ /g"
Javascript 12
$ cat ./scratch/hello.js
const Gtk = imports.gi.Gtk;
let mainWindow = null;
let app = new Gtk.Application();
app.connect("startup", function buildUI() {
const text = "Hello, World";
mainWindow = new Gtk.ApplicationWindow({
application: app, title: text
});
mainWindow.add(new Gtk.Label({ label: text }));
});
app.connect("activate", () => { mainWindow.show_all() });
app.run(ARGV);
> includes a shebang
Your thumb is on the scale. No shebang is necessary, and as you pointed out yourself, the equivalent in the Electron world is to 'simply declare an arbitrary webpage or js file filled with arbitrary modern HTML5 to be my "main" page/script'. And speaking of package.json...
> a bunch of calls to GTK stuff
Your thumb is on the scale. Electron developers learn how to deal with "Electron stuff". And, hello? JSX? React? These are things that are used extensively in this space and come with their own complexities and have to be learned. (And neither are even inherently Web things. They're inventions of "framework" people and live entirely in that layer.)
> And that is my point-- it's 42 lines too long
Your thumb is on the scale. There is no equivalent Electron app that is 0 lines long. And let's talk about the untold number of projects whose package.json require many more lines, even for small, trivial, or incomplete programs. That's package.json alone, i.e., before we even get to writing code that actually does anything. Besides that, the community around NodeJS is renowned for bloat and esoteric tooling. As a concrete exercise, take a look at any random repo on GitHub, and you're likely to find the root of the source tree filled a dozen or more auxiliary files. Simplicity is a strength, but it's not one valued very highly by the people who've ended up writing Electron apps and participating in the larger NodeJS community.
In any case, regardless of this stupid (stupid!) attempt at a takedown, you can't ignore that (a) you're responding, as mentioned before, to an argument you're imagining rather than the one anyone is actually making, (b) even if your response were on-target, the argument in it is anachronistic. To be able to "continue" the tendencies they've settled into now in 2020 is an impossible constraint when the entire context of this subthread is how Gnome folks' actions in 2011 could have led to a drastically outcome for how mainstream, cross-platform apps written in JS are developed. To insist that Electron is the best fit for a bunch of developers who are used to and comfortable with writing Electron apps is not insightful, it's just begging the question.