Skip to content

Commit

Permalink
tested locally
Browse files Browse the repository at this point in the history
  • Loading branch information
elmpp committed Apr 22, 2020
1 parent 018cc3b commit 8b31f5f
Show file tree
Hide file tree
Showing 3 changed files with 528 additions and 468 deletions.
3 changes: 2 additions & 1 deletion packages/rnv/src/configTools/configParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ export const versionCheck = async (c) => {
c.runtime.rnvVersionRunner
)} against project built with rnv v${chalk.red(
c.runtime.rnvVersionProject
)}. This might result in unexpected behaviour! It is recommended that you run your rnv command with npx prefix: ${recCmd} . or manually update your devDependencies.rnv version in your package.json.`
)}. This might result in unexpected behaviour! It is recommended that you run your rnv command with npx prefix: ${recCmd} . or manually update your devDependencies.rnv version in your package.json.`,
default: actionNoUpdate
});

c.runtime.versionCheckCompleted = true;
Expand Down
9 changes: 5 additions & 4 deletions packages/rnv/src/systemTools/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export const inquirerPrompt = async (params) => {
const c = Config.getConfig();
const msg = params.logMessage || params.warningMessage || params.message;
if (c.program.ci) {
if (Array.isArray(params.choices) && typeof params.default !== 'undefined' && typeof params.choices[params.default] !== 'undefined') return { [params.name]: params.choices[params.default] };
throw new Error(`--ci option does not allow prompts: ${msg}. Consider adding a default to the question`);
if (Array.isArray(params.choices) && typeof params.default !== 'undefined' && params.choices.includes(params.default)) {
return Promise.resolve({ [params.name]: params.default });
}
throw new Error(`--ci option does not allow prompts. Consider adding a default to the ${params.name} question: ${msg}.`);
}
if (msg && params.logMessage) logTask(msg, chalk.grey);
if (msg && params.warningMessage) logWarning(msg);
Expand All @@ -19,8 +21,7 @@ export const inquirerPrompt = async (params) => {
const { type, name } = params;
if (type === 'confirm' && !name) params.name = 'confirm';

const result = await inquirer.prompt(params);
return result;
return inquirer.prompt(params);
};

export const generateOptions = (
Expand Down
Loading

0 comments on commit 8b31f5f

Please sign in to comment.