dthree/cash

Make it easier to use inside npm script

rofrol opened this issue ยท 6 comments

Right now I need to do this:

  "scripts": {
        "ls": "node -e \"console.log(require('cash')('ls -l')); process.exit();\""
  }

I think this is a problem with any Node process running in NPM scripts.

There's a discussion here about integrating Cash into NPM to handle package scripts:

npm/npm#11291

But that's way down the road. Working it!


BTW, you can skip the process.exit(), it should quit by itself.


Also, try this:

"ls": "node ./bin/cash ls -l"

I need to use process.exit() otherwise it hangs.
I don't want to just use ls but use cash today in npm scripts.
So I thought that to make transition easier, add some option to cash, so that we can use

 "scripts": {
       "watch": "cash \"browserify -w index.js && postcss -w\""
 }

Perhaps we could implement the -c option. From Bash's man page:

       -c        If the -c option is present, then commands are read from the first non-option argument command_string.  If  there  are
                 arguments after the command_string, they are assigned to the positional parameters, starting with $0.

๐Ÿ‘

I opened #69 to address this feature.

@rofrol Once cash can accept -c 'input' (#75), then you can simply put script-shell = cash inside .npmrc and it should just work.