60 points · by mikece · 3y ago · 76 comments
I dunno man, this feels like stuff the Deno people could have predicted. I don't understand why people treat packages like the boogeyman. You need a way to share and reuse libraries. Then you need a way to version these libraries. Then you need a way to reuse versions of said libraries. Then you need a manager to handle the reusing and constraint solving of libraries. It's a pretty logical sequence of events. I know it seems icky and gross and we should all just be real programmers and write our own dependencies, but you don't get paid to write dependencies.
I guess that's the issue. The people who write stuff like Deno or Node do indeed get paid to write dependencies. And it's too easy to listen to the people complaining about straw men like is-odd when in fact, for all the messiness, developers get a lot of utility out of packages.
Brilliant take. I realized something similar yesterday when my twitter feed was filled with people saying SSR/edge compute is the future... wait a second, you all work at Vercel, you make money by me computing stuff server side!
On the retry I still have the confidence from the previous attempt but I can barely get a hit before being completely destroyed. How hard could it be? I was one move away from victory last time. But now the challenge is far more apparent.
This happens repeatedly as I use trial and improvement to learn the fight I so effortlessly put up in the first instance.
It reminds me of just how much is down to chance and what you did in a moment in time. Trying to consciously recreate it, but better, is a Sisyphean task.
One thing I've found with these types of games is getting into a "flow" works so much better than trying to consciously play the game. Unfortunately the only way to develop the muscle memory to be able to enter this flow state is to bash your face against enemies over and over until you're no longer thinking about how to react. I've also found that when I'm struggling with a boss, I'm playing in a much more conscious way which means I'm thinking about my responses instead of just reacting. When I get really close, but don't kill them, I often over focus on the piece which got me killed and which means my attention on the dozens of other things I've used to get to this point slips a bit and I get destroyed. At this point I usually know I'm too much in my own head and go off to areas I'm comfortable with to try to get back into a flow for the boss fight again.
(edited)
This is a tooling/ecosystem issue. E.g. in Elixir where the package manager is a part of the distribution, one-file scripts with dependencies are easy: https://fly.io/phoenix-files/single-file-elixir-scripts/
I'd like to see you argue the other side of this discussion & see if you have the eye to appreciate what is better & nicer.
There's a lot of complexity that's still way way way away in the rear view mirror. It's still super possible & super nice to use deps.ts to tackle a lot of the current situations.
Very side mention on deps.ts, I think there is a bit of missing potential to pass your tree of deps into other packages deps, but this is definitely just working around import-maps's intended use case in userland.
You mean:
- manually import and re-export every dependency you depend on
- cannot change resolution mechanism to a different package repository, for example, in a corporate setting. Especially not for dependencies of dependencies.
You could probably automate it by providing a package.json of sorts, and reading from there...
The goals of Deno and Node are different, the architecture is different.
Adding a compatibility layer helps Deno grow while maintaining its original goals.
I doubt this adds much complexity if done properly...
And here we are.
The forum had taken off while I was MIA. In spite of me being MIA. And while I could write a manifesto about how the forum had gone in a direction I didn't necessarily want, I had to admit that my plans for the forum weren't better nor more correct than the plans that emerged organically from the community over the years.
When you create something with a community and ecosystem, it's easy to see the success of the ecosystem and the downstream success of the people within it as your success when in reality you are more like an early collaborator who set the stage for others to join in and take it from there.
A good example of this in my case was the hubris that, because I created that one big forum, I could create more successful forums. I never hit gold again. I realized I wasn't some master forum creator, just someone who started something at the right time and the right place with just enough TLC to attract other builders, and that I didn't have some divine insight into how to start a successful forum. Oof.
What's wrong with a compatibility layer with npm if it's implemented properly?
His views on package.json and implementing a compatibility layer to help others transition from node are not mutually exclusive.
The support for node is pretty simple. Using NPM packages is straight forward. Reading a package.json file and using those mappings isn't complex either. Deno does not use node_modules in any of those instances...
The blog post explains in detail why these things are actually required and useful, and introduces the new deno.js file that is functionally equivalent to package.json. So even purely deno packages meant to be used entirely in the deno ecosystem are encouraged to use the new package.json 2.0, for many of the same reasons package.json was introduced in Node all those years ago.
Having typescript built in, having zero complexity, none of these compile-down difficulties is just so liberating, so much bad you don't have to tangle with.
Nodejs is “good enough”.
package.json is entrenched.
Deno gains nothing from not supporting package.json, and has everything to gain from becoming a “better node than node”.
Deno will pick up steam if it can become a drop in replacement for nodejs. Then people can start to exploit its unique features.
Ideally I could replace node and switch to deno by doing “npm install deno” from within an existing node project
(saving people a search)
I think simply being free to try for better is a necessary & obvious step for js. It's not puritanical at all, it's embracing a lost freedom, to improve & figure stuff out.
There are good reasons for things to converge the way they have. [EDIT: removed uncharitable reading]
We all bury bad memories. Feels like yesterday TypeScript couldn’t resolve a package because I set “moduleResolution: node16”
Oh wait, that’s still happening, because a dependency does not use the correct package.json exports setup.
Import-maps are like "here" to fix this on the web... finally... except they only are shipping to the happiest sunniest easiest case, with Web Workers being totally shit out of luck in spite of some very simple straightforward suggested paths forward. https://github.com/WICG/import-maps/issues/2
I think Deno is making pretty good tradeoffs along the way here. This looks like package.json at surface level, but there is a nightmare of complexity under the surface. Typescript, ESM, cjs all have various pressures they create & in Node it's just incredibly tight & tense dealing with packaging, where-as Deno's happy path of Typescript first does not slowly tatters one over time. It really has been super pleasant being free of the previous world, and having something much more web-platform centric, more intented, with less assembly & less building, and more doing the actual coding.
I confess I'm a bit surprised by this tack. The duplicate module issue felt somewhat solveable my offering more http urls... https://deno.land/std@0.179.0/uuid/mod.ts could be turned to https://deno.land/std@0/uuid/mod.ts to pick just the major version.
Also notably these un-pinned imports are going somewhat the opposite direction from hopefully upcoming work on subresource integrity in import-maps, where we we can really pin versions, https://github.com/WICG/import-maps/issues/221
I really hope import-maps eventually get broader support. Maybe this long-dwelling webworker issue should be brought up with WinterCG.
For instance, the current thing, from what I understand, is <code>import foo from 'https://some-cdn/your-library@^1.1.1'</code> and deno loads that in. The problem that adding a package.json solves (also, from my limited understanding) is for cases when you import this library in several places and have different version requirements.
So, why not have something like:
export const libraries = {
"some-library": "https://your-cdn/some-library@^1.1.1",
};
export const load = (library) => import(libraries[library]);
Wouldn't that mostly solve the problem without just doing what NodeJS does?Oh, perhaps write them in a JSON form in some sort of package.json and read them from there perhaps?
Maybe even have an executable that will read this file and understand your dependency graph and needs and install everything for you, and also allow you to keep it up to date.
Maybe put this in `utils/npm.js` // short for node package manager.
Brilliant. Lets all implement our own.
"imports": { "@namespace":"deno", "oak": "oak@12",
I thought I was making good progress until I tried burntsushi's edge case test suite. It reminded me of implementing YAML.
TOML is slightly nicer to write than JSON if your structure is flat, like a php.ini or Cargo.toml file. Other than that, I prefer the simplicity of JSON as well as the buy-in of JSON Schema support in apps like VS Code.
We too often do this thing as craftspeople where we dramatize how much minor pain points impact our lives while ignoring the upsides.