oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.95k stars 2.75k forks source link

Support npm-run-all #4402

Closed yus-ham closed 6 months ago

yus-ham commented 1 year ago

What version of Bun is running?

0.8.2+a846852818278641cf33413ce784adf2fc0e2e52

What platform is your computer?

Linux 5.15.0-67-generic x86_64 x86_64 - ubuntu 22.04

What steps can reproduce the bug?

make a project with only has npm-run-all in deps

{
  "name": "npm-run-all-test",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "all": "run-p echo-hello echo-world",
    "echo-hello": "echo hello",
    "echo-world": "echo world"
  },
  "devDependencies": {
    "npm-run-all": "^4"
  }
}

Run bun install && bun --bun run all

What is the expected behavior?

$ run-p echo-hello echo-world
$ echo hello
hello
$ echo world
world

What do you see instead?

error: Invalid stdio option
      at node:child_process:356:46
      at map (:1:20)
      at spawn (node:child_process:611:14)
      at node:child_process:2:40
      at spawn (/data/www/00-cup/bun-play/npm-run-all-test/node_modules/cross-spawn/index.js:12:20)
      at spawn (/data/www/00-cup/bun-play/npm-run-all-test/node_modules/npm-run-all/lib/spawn-posix.js:60:18)
      at /data/www/00-cup/bun-play/npm-run-all-test/node_modules/npm-run-all/lib/run-task.js:174:13
      at new Promise (:1:20)
      at runTask (/data/www/00-cup/bun-play/npm-run-all-test/node_modules/npm-run-all/lib/run-task.js:138:20)
      at next (/data/www/00-cup/bun-play/npm-run-all-test/node_modules/npm-run-all/lib/run-tasks.js:122:28)

error: script "all" exited with code 1 (SIGHUP)

Additional information

No response

silvenon commented 1 year ago

I just realized that that npm-run-all has last been published 5 years ago 😅 But I use it all the time!

concurrently works on Bun apparently so at least we have an alternative.

yus-ham commented 1 year ago

concurrently works on Bun apparently so at least we have an alternative.

I dont know about concurently. Mainly I use run-p for spawning php dev server. But finally, instead I replaced run-p with my own vite plugin using Bun.spawn() to start php-cgi

Electroid commented 1 year ago

Newest error as of Bun v1.0.7.

❯ bun --bun run all
$ run-p echo-hello echo-world
ERROR: Invalid stdio option "[object ReadStream]"
error: script "all" exited with code 1 (SIGHUP)
paperdave commented 1 year ago

to implement stdio option "[object ReadStream]", edit src/js/node/child_process.js, this is a implementation of the node api using Bun.spawn. we do not handle node streams as stdio inputs. some refactoring in the code is needed to allow nonstring stdio options, but this should be pretty easy to implement. idk if that's the only thing blocking it, but if so this would be a good "good first issue" tag.

beeryardtech commented 10 months ago

Is it possible to create a similar syntax as npm-run-all that allows for similar functionality. Example:

bun run-all -s lint:{foo,bar} -p serve:dev -p open:browser

## Which is the same as
bun run lint:foo
bun run lint bar
bun run server:dev &
bun run open:browser 
alexkuang0 commented 2 weeks ago

Why is this issue closed? I don't think bun is working with npm-run-all as of right now. (Sorry for the false claim. It works.)

nektro commented 2 weeks ago

@alexkuang0 if you have a repo or script that reproduces the issue on the latest version of Bun we'd be happy to get it fixed on a new issue

alexkuang0 commented 4 days ago

@nektro Sorry I want to make this right. It's now working for me. But I did encountered once when Bun didn't work with npm-run-all. I forgot how to reproduce it and I'm not even sure if Bun was the issue there. I have updated my previous comment to be false claim.