zaaack / foy

A simple, light-weight, type-friendly and modern task runner for general purpose.
http://zaaack.github.io/foy
MIT License
268 stars 15 forks source link

support set -e and set -v #8

Closed xiaoxiangmoe closed 5 years ago

xiaoxiangmoe commented 5 years ago

https://github.com/shelljs/shelljs/blob/a8775129f5dd668eeef48e3561046f1e1b31a7e2/README.md#setoptions

zaaack commented 5 years ago

@xiaoxiangmoe Could you please give a use case of set -e? I think set -v can be replaced via an implemented option logCommand, e.g.

task('test', async ctx => {
  ctx.logCommand = true // will log each command in current task, which is enabled by default
  await ctx.exec('ls')
})
xiaoxiangmoe commented 5 years ago

set -e for shelljs is set -o errexit for bash

zaaack commented 5 years ago

@xiaoxiangmoe Sorry that I have to close this issue because we have discussed in QQ IM. The shelljs is a great cross-platform shell implementation in js, that's why Foy won't replace it. : ) If you want shelljs just install it, I'm sure it works well with Foy.

The light shell implemented in Foy is only to provide a better external command execution helper then nodejs's built-in child_process, because calling tools like webpack, babel-cli, tsc, pm2, docker, etc. is a very frequent job when writing build scripts/tasks. But we should keep it simple to only cover the most common operations and still provide a light interface and install size. That's why I cannot approve this issue.

Thanks for your proposal anyway, feel free to reopen or create a new issue if you still have problems.