by gigel82 · 6y ago · 0 comments
I bet we'll have a bunch of competing standards for "dependency management" in deno coming online really soon, because there's an obvious need for that.
Also, are dynamic dependencies a thing? Can I run some code to decide (at runtime) whether I import this.package or that.package? Holy hell... with test coverage the way it is in most projects, that's going to blow up really fast.
That's my worst nightmare. This kind of thing always results in my having to spend hours figuring out which of the new updates broke everything and what do I have to do to fix it.
Once I have something working, I don't want updates to ever be installed unless I know 100% for sure that it is only fixing a security issue.
If that's too much work you can just deploy to a subset of your users (after npm audit) and let the error monitoring system tell you about the new exceptions.
> curl -fsSL https://myapp.io/install.sh | sh
Thats pretty scary. It might do anything to user data. The deno sandbox would offer more assurances of course:
> deno run --allow-write=~/.myapp https://myapp.io/install.sh
You know it would only access what you expect. Same with another command:
> deno run --allow-read=./my-data.csv https://data-app-thing.io/visualize-data.ts my-data.csv
It's as described, a browser, not a server platform.
If you need a million packages to write a tiny application Deno may not be your cup of tea. The entire article is about readjusting your expectations away from that kind of incompetence towards an alternative approach.
Your application can intentionally choose only to depend on a small number of libraries, but of course those libraries will need to consume other libraries, and so on, and you rapidly end up with hundreds of dependencies in node_modules.
If we wanted to solve this, we could introduce a comprehensive standard library. However, we'd need it to be bundled with every existing browser (and Node.js), which is likely why it hasn't happened.
If we had a proper standard library and a sane package manager with flat dependency resolution by default, bundling just the parts of the standard library we need for the web would be easy (browserify has existed for a long time).
You finish that statement with a phrase completely at odds with this part about no standard library. After having written applications using Node for a decade now I have learned to see the real problem is developers not wanting to write or own original code. No standard library will be comprehensive enough to fix that.
Websites have been doing this for .. 20 years?
It's quite a different paradigm, yes.
Working with node backend in the past few years, most of my backend services typically list a dozen dependencies or so in package.json, and those in turn have a bunch of other dependencies of their own. Among these there's probably lodash, some schema validator (ajv/joi/etc.), maybe an xml parsing/building lib, some unit testing framework, db query builder, and so on.
I'm not saying this to be pro-node and attack deno or anything; I just feel like the statement of "websites/browsers have been doing this forever" isn't exactly an apples to apples comparison.
Web developers have been trying to move away from that paradigm in order to make sites faster, more reliable, and smaller for almost as long.
Well that certainly explains the state of the 'modern' web
My comment wasn't about URLs describing their content, but rather the assumption that goes along with it that every network request will always work perfectly. Once you realise that things do actually fail occasionally you should realise that local caches and bundling things in to a smaller number of requests can improve resilience.
That's not really an issue with Deno because it does things to mitigate the issue (eg caching packages locally), but websites that loaded libraries using separate requests for each one were horribly prone to failure if one thing was missing, and slower overall if the browser couldn't fetch everything in parallel, so devs invented things like bundlers to fix the problem. Then came things like code-splitting and tree-shaking to reduce the size.
This could lead to many copies of a library being loaded and included, rather than just one via deduplication as other packaging systems tend to do.
(The article talks about the potential need to remap dependencies, which could allow you to resolve this sort of duplication manually, but says that the current implementation should probably be avoided.)
Personally I am a big fan of https://github.com/hayd/deno-udd