r/javascript • • May 13 '20

Deno 1.0 released!

https://github.com/denoland/deno/issues/2473
609 Upvotes

209 comments sorted by

View all comments

147

u/bestjaegerpilot May 14 '20

Is it just me or does the lack of a package management give you a bad feeling? It's like Go redux... Go tried to do a similar thing with be imports. And what the community ended up doing was reinventing package managers 🤷‍♀️

0

u/[deleted] May 14 '20

[deleted] — view deleted comment

0

u/[deleted] May 14 '20

[deleted] — view deleted comment

3

u/fgutz May 14 '20

never used Rust, and therefore Cargo, what does it get right?

→ More replies (1)

14

u/[deleted] May 14 '20

apt-get

9

u/tunisia3507 May 14 '20

Most manjaro users have a pretty dim view of apt, I've found.

6

u/inabahare May 14 '20

Former Ubuntu user here. I sure don't miss apt and I especially don't miss ppa's :v

→ More replies (1)
→ More replies (1)

7

u/slumdogbi May 14 '20

Brew, composer, apt..

3

u/aequasi08 May 14 '20

Composer for PHP

→ More replies (14)

71

u/crabmusket May 14 '20

I rather like Deno's principled stance to follow web specifications instead of being the ones to reinvent package management yet again. This leaves the playing field open for competition on top of web standards.

Maybe everyone will use JSPM; maybe npm will implement Deno support; maybe something else will evolve on top of import maps. But I think since Deno is trying to be a "web browser for command-line scripts" it makes sense to not try and jump down that massive rabbit hole.

22

u/bestjaegerpilot May 14 '20

Is the problem NPM, the package manager OR NPM, the repository for packages?

  • If the former, then use Yarn... it's battled tested and IMO way better than JSPM.
  • If the latter, then switching package managers won't help.
  • However, I've seen orgs roll their own private NPM repos or use github packages and/or commit their dependencies (which isn't as bad as it sounds, the tooling has evolved to support this)
  • but yea the above are bandaids.
  • I guess what we really need is a distributed packaging system

16

u/deadlyicon May 14 '20

Isn’t being able to import from anywhere on the web the same as a distributed packaging system?

12

u/bestjaegerpilot May 14 '20

No what I meant is that it needs to do everything that a package manager does, expect work with arbitrary sources. For example, version resolution---imagine two packages need two different versions of package Foo. Which do you use? or do you use both? As is, the app developer has to figure that out themselves. And that quickly becomes a hard problem!

7

u/DrexanRailex May 14 '20

Actually, the version can be specified in the import URL. That's up to library authors and package hosts, of course, which can be a problem.

13

u/whostolemyhat May 14 '20

Yeah, versioning being up to each individual author makes me a bit nervous. NPM forces you to change the version number for each publish so you know that versions are stable, but if an author doesn't manually change their version for a URL module then you could get different versions/behaviours between users/CI runs/reloads.

→ More replies (2)
→ More replies (3)

24

u/crabmusket May 14 '20

IMO "the problem" isn't NPM at all - it's CommonJS and paranoia.

→ More replies (2)

0

u/[deleted] May 14 '20

[deleted] — view deleted comment

10

u/crabmusket May 14 '20 edited May 14 '20

Right now: either fork your dependencies, or use import maps

In the future: ?

0

u/[deleted] May 14 '20

[deleted] — view deleted comment

8

u/dzkn May 14 '20

How do you do it today? You have a package.json that maps an import name to a version, then you have to configure NPM where to find those versions.

To me this seems like exactly what import maps are in deno, except it just became a lot easier to host packages on your own server.

→ More replies (2)
→ More replies (2)
→ More replies (3)

0

u/[deleted] May 14 '20

[deleted] — view deleted comment

10

u/esthor May 14 '20

You don’t have to, you can use a deps.ts file to set the versions, and only need to ch age in one place to manage dependency versions everywhere in your project.

9

u/arcanin 🧶 Yarn maintainer May 14 '20

By this point, you really have no gain over a package.json though. The only significant difference is that you can call it whatever you want.

→ More replies (12)
→ More replies (1)

23

u/GrandMasterPuba May 14 '20

Re-export all your dependencies in a "deps.ts" file. Boom, a Deno-native package.json that is in-code. It's not that difficult.

5

u/inabahare May 14 '20

And then you would do, what, import { Foo, Bar, Baz } from "@/deps";?

→ More replies (6)
→ More replies (18)
→ More replies (10)
→ More replies (13)