cli icon indicating copy to clipboard operation
cli copied to clipboard

Going through CLI is slow

Open jedwards1211 opened this issue 8 years ago • 4 comments

It seems like the CLI does something after I answer each question it asks. I'm getting tired of how long it takes; I create a lot of packages. Couldn't it just ask all the questions upfront, and then do all of the work afterward so that we don't have to sit and wait for each question?

jedwards1211 avatar Dec 06 '17 20:12 jedwards1211

Did you try

semantic-release-cli setup --gh-token=... --npm-token=...

That should speed up things

gr2m avatar Dec 09 '17 00:12 gr2m

Yeah...but that requires remembering all the arguments. Going through prompts is easier on the brain except for the waiting. Though I guess since I pretty much always pass the same arguments I could just make a little script that calls it.

Would you be willing to accept a PR? I see that this is happening because the code basically requires the modules in sequence, which means each one prompts and then does its stuff before moving onto the next prompt:

    await require('./lib/repository')(pkg, info);
    await require('./lib/npm')(pkg, info);
    await require('./lib/github')(pkg, info);
    await require('./lib/ci')(pkg, info);

I could refactor this to store all the input first and then pass it in when it does the real work afterward:

const steps = [
  './lib/repository',
  './lib/npm',
  './lib/github',
  './lib/ci',
]
const userInput = {}
for (let step of steps) {
  const {prompt} = require(step)
  if (prompt) userInput[step] = await prompt(pkg, info)
}
for (let step of steps) {
  await require(step)(pkg, info, userInput[step])
}

jedwards1211 avatar Dec 10 '17 05:12 jedwards1211

That doesn't really matter. I tried requiring everything first locally, and that hardly makes any difference. Apparently the biggest impact is from the actions it performs after the questions.

kbrandwijk avatar Jan 06 '18 04:01 kbrandwijk

@kbrandwijk I was suggesting separating the inquirer prompts from the action steps so that I could do all the questions first before doing any of the actions

jedwards1211 avatar Aug 25 '19 17:08 jedwards1211