-
Notifications
You must be signed in to change notification settings - Fork 28
refactor(index): rewrite answer parsing #541
Conversation
There were a couple things that didn't work as expected - isQuestionAsked actually implemented shouldQuestionBeAsked (opposite to the name) - getOptionsFromArguments isn't needed, Commander already exposes arguments - splitting array manually can be done in Commander - confusing "when" conditional for array values - validation of appName can be done inline so it doesn't error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code change looks good overrall.
However, why do we now ask questions when the necessary options were passed to the CLI?
This original behavior was made as a convenience. The release script that generates the demos will also probably fail now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
message: 'Project directory', | ||
const isValid = Boolean(input); | ||
if (!isValid) { | ||
console.log('template is required'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This console.log
shouldn't be required, our script errors by itself like with other options, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would error in
throw new Error('The template is required in the config.'); |
create-instantsearch-app/src/cli/index.js
Line 339 in e067902
process.exit(1); |
…-app#541) * refactor(index): rewrite answer parsing There were a couple things that didn't work as expected - isQuestionAsked actually implemented shouldQuestionBeAsked (opposite to the name) - getOptionsFromArguments isn't needed, Commander already exposes arguments - splitting array manually can be done in Commander - confusing "when" conditional for array values - validation of appName can be done inline so it doesn't error BREAKING CHANGE: the program now asks questions if some of the parameters are sent via arguments. Before this, giving an argument would cause it not to ask any questions anymore, even if they still would be useful. You can avoid this behaviour by passing --config or --no-interactive * postprocess answers * e2e installs should not have any asked questions * make e2e build test pass * more info * update to newer commander to fix the "name" issue * refactor: validate appPath like appName * error for empty string path * clean lockfile * refactor initial questions * silently check for existing answers on appName * don't ask initial questions if config is set * introduce --no-interactive, mostly for test * write tests * fix argument * undo change * make .default apply always * refactor templates to be part of initialQuestions * cover initialQuestions in tests * fix error
There were a couple things that didn't work as expected
BREAKING CHANGE: it now asks questions if some of the parameters are sent via arguments. Before this, giving an argument would cause it not to ask any questions anymore, even if they still would be useful. You can avoid this behaviour by passing --config or --no-interactive