moleculerjs / moleculer-cli

:herb: Command line tool for Moleculer
http://moleculer.services/docs/moleculer-cli.html
MIT License
49 stars 28 forks source link

Add a flag to make it so that you can avoid the overwrite prompt in init #21

Closed zacbraddy closed 5 years ago

zacbraddy commented 5 years ago

Hi there

I'm making a service generator for our services that are using moleculer and as part of that I'm using the moleculer-cli init function to upgrade services that already exist. Basically the process that I've automated thus far is delete all files that aren't logic relating to the function of the service itself and then run moleculer init again (there's a bit more to it but I'll save you the explanation as that isn't the issue).

This upgrade process is something that I plan to run quite frequently and I want to be able to just quickly hit enter through the prompts. But when I get to the overwrite one it's defaulted to false so I end up accidentally exiting out of the process.

I was wondering if it would be alright for us to modify the code for init so that we could put a flag in the meta.js to toggle whether we want to have that prompt or not. Basically we could just add a line before this one that would be something like:

if (templateMetadata.promptForProjectOverwrite === false) return;

I'm happy to put in a PR for this but wanted to raise the issue first to make sure that this was ok with the project maintainers.

Cheers Zac

icebob commented 5 years ago

Hi Zac,

good idea, please create a PR with this feature.

zacbraddy commented 5 years ago

Sorry for the delta, had a a busy couple of weeks. Here is your PR. Thanks for being so cool about putting this in.