It's like building a robot to pass the butter.
It's like building a robot to pass the butter.
You could set up some CI to make automatic builds after merging to master, but that still wouldn't solve the problem of contributor wanting to test what he wrote.
I just took a second look at the repo, and realized there's no package.json. Typically, an open-source JavaScript project would have one. It would enumerate the dependencies and how they work together to generate the final output.
As a JavaScript contributor, I expect to be able to type
yarn
yarn run build
into any repo to generate the output (and test any changes I've made).I suspect the interactive web is not the author's primary platform. That's fine - it's his project; he can structure it however he wants. I was just surprised to see an unfamiliar, nontrivial dependency to concatenate a handful of lines into a bookmarklet.
Since you asked "Do you know a better way?" you can port the `npm install` line to a dictionary of dependencies in package.json. You can use wireit in that same file to chain the CLIs together, accomplishing what's currently the ENTRYPOINT line in Dockerfile.
It does the same thing that the current setup does, but it follows the conventions of the ecosystem. This makes it more available to external contributors, because they don't have to learn/install tools like Docker that aren't typically seen in JS.
I’m reality it’s just using node. But removed the requirement to set node up.
Just depends on what you expect your contributors to be more familiar/comfortable/ready for. For most JS projects, package.json is the expected onramp for new contributors. We all have node installed.
Not everyone has NodeJS. And not everyone has Docker, either. You know what we all do have?
A Web browser. The World Wide Wruntime.
You know—it's the thing that you're using to look at the README on GitHub (and this comment, probably), and is the reason that JS and bookmarklets even exist in the first place. It's widely popular exactly for its ability to publish/share content and apps without any onerous install step. (It's pretty nifty. NodeJS programmers should really consider looking into it sometime.)
Build.app.htm. Double click and then drag and drop the project source tree onto the browser tab. Done.
If you happen to already have all this trash installed in your user space and you like typing several commands instead of 1 command (make): great, just run it without Docker, nobody forces you to install it. What's even the problem…
If it were my project I'd just be assuming contributors had internet access and advising in the readme to "search for a good 'bookmarklet generator', paste in your code, then test it". I'd then test their tested bookmarklet code before accepting any PRs. Thus reducing the repo to two files and 1% of current complexity, most of that being in the readme itself.
I definitely don't think I'd start with a build system for a bookmarketlet.
I use Docker for everything locally. As a Python dev tired of fighting with different versions, virtual environments, wheel-issues etc...
> This makes it more available to external contributors, because they don't have to learn/install tools like Docker that aren't typically seen in JS.
I feel it's a bigger burden on me having to install whatever tools a random project expects. I vastly prefer a Dockerfile that just works, without me having to spend hours matching their setup, and also has the benefit that it doesn't pollute my system with lots of stuff.
If only there were some sort of ubiquitous platform—a World Wide one, even—that we could reliably depend on to fetch remote resources and that was especially suited for executing JS. It would need to run the code in a sandbox of, course, to ensure that it's acting in the interests of the user—a sort of "user agent"—and not just executing arbitrary code with full rwx privileges in the interests of the script author.
Maybe in a more perfect world...
Previously: <https://news.ycombinator.com/item?id=24495646>