callerc1 / shipit-npm

Npm tasks for shipit.
MIT License
21 stars 12 forks source link

Setting cmd for npm:cmd in any other way than command line arg? #15

Open holden-caulfield opened 8 years ago

holden-caulfield commented 8 years ago

I'm using shipit-npm as part of my overall build/deploy strategy, and for some workflows besides just doing the regular npm install it would be good for me to leverage the npm:cmd task to run some other npm scripts I have.

For example, after npm install it would be great for me to run a "build" script I have defined on my package section.

So my shipitfile would have a sniped like this

shipit.on('npm_installed', function() { shipit.start('npm:cmd') });

Problem here is that I don't have any way to pass which script to run. Only way I can do it is with a parameter on the command line itsel, something like

shipit staging deploy --cmd 'run build

Which works, but is a bit obscure for somebody else to read and understand what it does.

It would be great if this could be passed as a config option or something. Maybe an option on the npm config at shipit?

Let me know if there is a way to achieve what I'm looking for, or if you want I can try doing a quick PR to add the ability to pass cmd as a config option

ghost commented 7 years ago

Any plan to merge this fix ? very useful indeed...