sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Feature request: task manager

Open similonap opened this issue 2 years ago • 4 comments

Bug report

Packages affected

  • [ ] sandpack-client
  • [*] sandpack-react

Description of the problem

"scripts": {
    "start": "tsc -p . && node index.js"
  },

works in normal codesandbox but not in sandpack.

similonap avatar Mar 07 '23 13:03 similonap

In your opinion, @DeMoorJasper, what sandpack must do for these cases?

  • Spawn two processes synchronously using the same shell instance;
  • Create a queue for processes and create multiples shell instances;

It sounds like a big challenge since we need to wait for one process to be finished and spawn another one, so I'm not absolutely sure what's the correct way to go here.

danilowoz avatar Mar 07 '23 14:03 danilowoz

Ideally we would have a command parser that takes into account env variables and these operators. We could create a very basic ast type structure from a command and some CommandRunners.

In this case it would be run tsc -p . wait for process to exit and than run node index.js using the same shell instance. This is a fairly simple one, there's a couple more complex ones like the pipe operator |

DeMoorJasper avatar Mar 07 '23 14:03 DeMoorJasper

I spent some time working on a command parser: https://codesandbox.io/s/command-shell-parser-4pknfv?file=/src/index.ts

What do you think @DeMoorJasper?

danilowoz avatar Mar 09 '23 16:03 danilowoz

@danilowoz Looks very good, just fixed something where or is actually pipe and added the symbol for or

DeMoorJasper avatar Mar 14 '23 14:03 DeMoorJasper