plopjs / plop

Consistency Made Simple
http://plopjs.com
MIT License
7.06k stars 277 forks source link

feat: add onProgress hook #430

Open benallfree opened 5 months ago

benallfree commented 5 months ago

@crutchcorn I'm curious to see what you think of this PR.

It adds an onProgress hook and makes it available to be called from custom action handlers like this:

const myCustomAction =  async (answers, config, plop)=>{
   const { onProgress } = config
   onProgress(`Starting action`)
   return new Promise(resolve=>{
      setTimeout(()=>resolve(`Finished action`),1000)
   }
}