Live data from Hacker News

Bun v1.3.9

bun.com

11–20 of 54 posts

Re: Bun v1.3.9

#11
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

A few reasons.

1. Minor speed boost from not needing bun multiple times (or extract the build/test/lint commands from package.json).

2. You can query/filter commands. E.g. run all my tests (both unit and integration).

3.You avoid needing a separate Bash install (for Windows).

Re: Bun v1.3.9

#12
post #10
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

It lets developers on Windows also build and test your package in parallel mode. If you make your build scripts bash, they're Linux-only.

> if you make your build scripts bash, they’re Linux only

Git bash exists on windows and is perfectly usable.

Re: Bun v1.3.9

#13
post #12
post #10

Earlier quoted context omitted.

It lets developers on Windows also build and test your package in parallel mode. If you make your build scripts bash, they're Linux-only.

> if you make your build scripts bash, they’re Linux only Git bash exists on windows and is perfectly usable.

It's still much less dependable compared to something fully supported like Bun.

Re: Bun v1.3.9

#14
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

> when I can just write a simple bash script to accomplish the same thing

At this point you don't need most things...

Re: Bun v1.3.9

#15
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

I get where you're coming from and if this was a package I'd agree - but having this built in/part of the tooling is nice - one less dependency - bash isn't as ubiquitous as you assume.

Re: Bun v1.3.9

#16
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

As a note here, there are a lot of resources that make bash seem incredibly arcane, with custom functions often recommended. But a simple interruptible script to run things in parallel can be as simple as:

    (trap 'kill 0' INT TERM; cmd1 & cmd2 & cmd3 & wait)
Or, for 1+2 sequentially, in parallel with 3+4 sequentially:

    (trap 'kill 0' INT TERM;
      (cmd1 && cmd2) &
      (cmd3 && cmd4) &
      wait
    )
(To oversimplify: The trap propagates the signal (with 'kill') to the process group 0 made by the () parens; this only needs to be set at the top level. & means run in background, && means run and continue only on success.)

There are other reasons one might not want to depend on bash, but it's not something to be afraid of!

Re: Bun v1.3.9

#17
Parallel and sequential, especially at the command level, are really the wrong abstractions for running scripts. If you have multiple packages, each with builds, there's a high chance you have dependencies and multiple packages depending on common ones.

What you really want is a way for scripts to describe their dependencies, and then the runner figures out what order to run them in, and cache scripts that don't need to be run because their inputs didn't change.

Wireit[1] is an npm script runner that adds that incrementally on top of package.json. I can't manage an npm monorepo without it now.

Deno started integrating the idea directly into their built-in script runner. I think this is an important enough feature that more runtimes should follow Deno's lead.

[1]: https://github.com/google/wireit

Re: Bun v1.3.9

#18
post #14
post #4

Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?

> when I can just write a simple bash script to accomplish the same thing At this point you don't need most things...

But this is no more than 5 lines of code. If it was 100 I’d understand.

Re: Bun v1.3.9

#19

Parallel and sequential, especially at the command level, are really the wrong abstractions for running scripts. If you have multiple packages, each with builds, there's a high chance you have dependencies and multiple packages depending on common ones. What you really want is a way for scripts to describe their dependencies, and then the runner figures out what order to run them in, and cache scripts that don't need…

If only we could make something like that

But now we would need each script to independently do their own caching, which isn’t all bad. At least you have more cross runner compatibility and resilience

Re: Bun v1.3.9

#20
This is nice to see, but I'm curious to check if the web socket bugs are all gone (I had a watch on a particular one that stopped me from running Node-RED in some circumstances, but can't find it on mobile...)
Post reply on HN