4 ms·
If you are going to use a build tool and you decide to create a new one written in JS, then please write it in standard JS (i.e. what Web browsers implement; no
by cxr 2y ago
If you are going to use a build tool and you decide to create a new one written in JS, then please write it in standard JS (i.e. what Web browsers implement; nothing to do with standardjs.com) that calls standardized APIs (again, all browsers—the things that everyone already has installed—implement them). Please don't code directly against e.g. proprietary Node APIs.
If you have a stupid simple HTML+CSS+JS project that nevertheless uses a build tool for some reason, a contributor should be able to clone the repo, open the README, read the instructions on how to build it and not encounter "first, install bun" (or whatever); in 90+% of cases, those instructions don't actually need be anything more complicated than "First, open the build script in a browser tab. Now drag and drop the project folder onto the build tool." You can double up and make that build script your README if you want—call it README.html.
It's baffling the numbers of folks who decided to focus on JS development because they wanted to draw on their familiarity/desire for developing for the browser and out of recognition that being able to create browser-based apps and deploy to users without making them install anything is a huge boon... and then went on to make a bunch of shoddy tooling that despite itself being nominally written in JS still requires you to download a bunch of other stuff to run it and doesn't leverage the standard JS runtime that everyone _already_ has installed.
- adamtaylor_13 2y agoI feel like installing node is an incredibly low bar. I agree on the principle, but reality is that “first installing bun” is so damn easy that reality and principle diverge quickly.
- deleted 2y ago[deleted]
- saulpw 2y agoFor now.
- wiseowise 2y agoGood luck installing bun on my locked work machine that doesn’t have bun cleared.
- hinkley 2y agoDoes this system prevent you from installing node via nvm?
- adamtaylor_13 2y agoIf your work machine doesn’t have the tools needed to perform your job, that’s a different problem than not having bun installed.
- cxr 2y agoYou haven't demonstrated anywhere that this word you're using—needed—is applicable to the context: bun, etc. being shoehorned into projects' build prereqs despite most projects not needing a separate runtime for doing anything the browser can't. (Not everyone who's trying to use something on a work machine is doing it because it's a requirement of their job, either.)
- adamtaylor_13 2y agoWork machine = for doing work. I have no sympathy that you can’t install a toolset not required for your job, on a machine dedicated to doing your job.
- cxr 2y agoYou seem to specialize in half-thought out dismissals and one-liners. Do you understand what "required" and "needed" mean?
- adamtaylor_13 2y agoIf you’ve got a point, go ahead and make it. If you just plan on brainlessly lecturing, feel free to go dump on someone’s else’s thread, friend.
- cxr 2y ago
- wiseowise 2y ago> Please don't code directly against e.g. proprietary Node APIs. What Node APIs are proprietary?
- mattlondon 2y agoAll of them? You need to have node installed to use them. Standard APIs work in chrome or Firefox or safari.
- fragmede 2y agobut you have to have chrome or Firefox or safari installed to use those APIs. What if you're somewhere that doesn't have any of those as an option?
- mattlondon 2y agoThe point I was making was that the standard APIs are standards implemented by many different runtimes/environments/browsers etc. If you target specifically Node so that you can use the non-standard features that only Node has, then you can only use Node. Proprietary. Target the standard APIs and you can use anything.
- franciscop 2y agoPlease clarify how you'd be e.g. reading JS files in a Node.js/Bun/worker/function/etc without using Node.js (or any of those platform/runtime-specific platforms) APIs? I'm not sure I'm following.
- nine_k 2y ago"Drag the project folder onto that" probably means you're uploading the entire project, and them make the result downloadable (as e.g. tar.gz or zip), without ever having to directly interact with stuff like filesystem. If that could be pulled off, it would be a great way to isolate the build process and prevent malicious packages or build tools from mucking with your system. Does not look very realistic for projects of any considerable size though.
- cxr 2y ago"upload" and "download" are misnomers, but yeah, pretty much. To the original commenter: I don't recommend using Node. I said use the World Wide Wruntime instead. Even so, there's a difference between an app that might incidentally use an API somewhere down the line versus programming directly against that interface. Look at the early versions of the TypeScript compiler. Here's 1.8: <https://github.com/microsoft/TypeScript/blob/release-1.8/src/compiler https://github.com/microsoft/TypeScript/blob/release-1.8/src...> tsc doesn't care whether it's running on Node or in the browser or somewhere else. I think the TypeScript team originally bootstrapped it with the Windows Script Host JScript implementation (available pre-installed on all Windows machines) and didn't start using Node until later on. The only thing the compiler cares about is that something implements the ts `System` interface, so the compiler can invoke e.g. the read-file operation (which belongs to `sys`, i.e. `sys.readFile`) and that it does what it's supposed to do. And it can use the method/capability for listing directory contents, the one for getting the arguments, and so on. That's all defined and implemented straightforwardly in a short file sys.ts. Figure out what services (capabilities) your program actually needs and sketch out an interface that permits all those things. Then write your program against that interface. It'll make your program more readable, anyway. > Does not look very realistic for projects of any considerable size though. Define "realistic" (or "considerable size"). All of Firefox's non-core (i.e. not Gecko) components and the build phase involving them that produces the final release package (~90MB[1]) could probably work this way. (If anyone actually cared about it[2].) Maybe even VSCode, too. Could you do this with any given project you stumble across on GitHub today? Maybe not, but that's because your average NPM programmer turns out programs that use entirely Too Much Fucking Code for what ultimately is just a todo app or whatever. I once benchmarked create-react-app's "hello world" exercise from a blank slate a few years ago. The numbers involved ended up with `node_modules/` taking up something like just under HALF A GIGABYTE of disk space. For a "hello world" app. That's nuts. 1. <https://ftp.mozilla.org/pub/firefox/nightly/2024/09/2024-09-01-09-21-44-mozilla-central/ https://ftp.mozilla.org/pub/firefox/nightly/2024/09/2024-09-...> 2. <https://news.ycombinator.com/item?id=41358029 https://news.ycombinator.com/item?id=41358029>
- mattlondon 2y agoAgreed. Too much stuff assumes NPM is available for installing things. I don't have NPM installed and I never want to install it either.
- davidmurdoch 2y agoWhat languages do you use that don't have a package manager?
- sabbaticaldev 2y agoyou don’t need to use npm to add packages to a JS project
- davidmurdoch 2y agoyou don't need to use a mouse to use a computer. But you probably do.
- rollcat 2y agoRolling with your metaphor, trackpoints, trackpads, trackballs, digitisers, or touchscreens are strongly preferred by many, as mice have usability tradeoffs & problems by design. Nobody here is arguing against code reuse (pointing devices).
- davidmurdoch 2y agoYeah, so they could have just answered my original question.
- deleted 2y ago[deleted]
- meiraleal 2y ago> What languages do you use that don't have a package manager? > Yeah, so they could have just answered my original question. That's not a real question, just you trying to be a know-it-all and failing miserably. conflating dependency management with npm is your mistake, especially now with ESM. You can just do import React from "https://esm.sh/react" No NPM needed
- pjmlp 2y ago1000% on that.