Live data from Hacker News

Deno 1.6 supports compiling TypeScript to a single executable

github.com

11–20 of 284 posts

Re: Deno 1.6 supports compiling TypeScript to a single executable

#11
post #6

Just throwing it out there for visibility, ncc will compile a TS entrypoint down to a single file as well, without having to use Deno https://www.npmjs.com/package/@vercel/ncc Edit: I completely missed that this Deno release packaged the runtime as well, disregard this as an alternative! Guess I’ll eat the downvotes I deserve :P

> without having to use Deno But you need to use ncc? What's the relevant difference?

You need `ncc run` to run the generated file.

https://github.com/vercel/ncc#commands

Re: Deno 1.6 supports compiling TypeScript to a single executable

#12
post #9
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

A lot of languages are doing single static binary deploys now. Rust, Nim, Go. It's a really nice pattern. Static binaries are so much easier that the gross PHP / Ruby / Python pattern that has to ship directories full of files that (usually) have to be put in the correct place. It's also easier than shipping a runtime like a JVM. With a single binary, containers get even slimmer.

> With a single binary, containers get even slimmer.

Not really. I agree on the other benefits of binaries but our containers usually only have the final layer change (the source code). This means that all the lower layers, python base image, requirements, etc are cached. So we can ship 100 times and add maybe 100mb of new container overhead. Binaries will ship 100% every time.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#13
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

Definitely, I do wonder how it compares in binary size. Especially the 'baseline' size of a hello world.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#14
post #9
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

A lot of languages are doing single static binary deploys now. Rust, Nim, Go. It's a really nice pattern. Static binaries are so much easier that the gross PHP / Ruby / Python pattern that has to ship directories full of files that (usually) have to be put in the correct place. It's also easier than shipping a runtime like a JVM. With a single binary, containers get even slimmer.

Do they? As far as I know, Go is the only mainstream language that supports static binaries with normal non-trivial programs. Rust for example depends on dynamically linked libc if you use the standard library. While you technically can statically link libc, it is unsafe with glibc.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#15
post #13
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

Definitely, I do wonder how it compares in binary size. Especially the 'baseline' size of a hello world.

The files are big now. ~30 MB.

Size was not really a goal for the first pass of the feature.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#16
post #5

Does this offer a speed increase vs running the the code directly using $ deno test.js ( not sure what the exact command is )

Not really, I think. Startup of a "hello world" seems to be 5ms faster on my Windows machine: https://gist.github.com/MarkTiedemann/c2f4013c3a60bb28df5005...

Re: Deno 1.6 supports compiling TypeScript to a single executable

#17
post #13
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

Definitely, I do wonder how it compares in binary size. Especially the 'baseline' size of a hello world.

The link shows its 48MB for a trivial program (I assume its trivial - its called "cat")

Re: Deno 1.6 supports compiling TypeScript to a single executable

#18
post #5

Does this offer a speed increase vs running the the code directly using $ deno test.js ( not sure what the exact command is )

No, there's not really any optimization. It's more of a bundling convenience. It still includes V8.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#19
post #13
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

Definitely, I do wonder how it compares in binary size. Especially the 'baseline' size of a hello world.

Seems like it's big, our Go CLI clocks in about 30MB on Linux. Deno with hello world is like 32MB.

But I honestly don't mind up until about 100MB.

Re: Deno 1.6 supports compiling TypeScript to a single executable

#20
post #9
post #2

This is such a good feature. Go has been great for shipping single purpose binaries (like the CLI for https://fly.io ), but I really enjoy writing TypeScript more than Go.

A lot of languages are doing single static binary deploys now. Rust, Nim, Go. It's a really nice pattern. Static binaries are so much easier that the gross PHP / Ruby / Python pattern that has to ship directories full of files that (usually) have to be put in the correct place. It's also easier than shipping a runtime like a JVM. With a single binary, containers get even slimmer.

Yeah, its especially horrible in python for webdev. How are you supposed to deploy django/flask projects when NOT using docker or some PassS?

I haven't figured out anything better than a git pull script to update things. I can't imagine there is nothing better in 2020.

Post reply on HN