core module always asks its questions (no accept defaults
This commit is contained in:
parent
3f76c2de74
commit
c0f5d33c61
|
|
@ -582,26 +582,23 @@ class ConfigCollector {
|
||||||
|
|
||||||
// If there are questions to ask, prompt for accepting defaults vs customizing
|
// If there are questions to ask, prompt for accepting defaults vs customizing
|
||||||
if (questions.length > 0) {
|
if (questions.length > 0) {
|
||||||
// Get friendly module name from config or use uppercase module name
|
|
||||||
const moduleDisplayName = moduleConfig.header || `${moduleName.toUpperCase()} Module`;
|
const moduleDisplayName = moduleConfig.header || `${moduleName.toUpperCase()} Module`;
|
||||||
|
|
||||||
// Add blank line for better readability
|
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
// Display the module name in color first
|
|
||||||
console.log(chalk.cyan('?') + ' ' + chalk.magenta(moduleDisplayName));
|
console.log(chalk.cyan('?') + ' ' + chalk.magenta(moduleDisplayName));
|
||||||
|
let customize = true;
|
||||||
|
if (moduleName !== 'core') {
|
||||||
|
const customizeAnswer = await inquirer.prompt([
|
||||||
|
{
|
||||||
|
type: 'confirm',
|
||||||
|
name: 'customize',
|
||||||
|
message: 'Accept Defaults (no to customize)?',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
customize = customizeAnswer.customize;
|
||||||
|
}
|
||||||
|
|
||||||
// Ask user if they want to accept defaults or customize on the next line
|
if (customize && moduleName !== 'core') {
|
||||||
const { customize } = await inquirer.prompt([
|
|
||||||
{
|
|
||||||
type: 'confirm',
|
|
||||||
name: 'customize',
|
|
||||||
message: 'Accept Defaults (no to customize)?',
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (customize) {
|
|
||||||
// Accept defaults - only ask questions that have NO default value
|
// Accept defaults - only ask questions that have NO default value
|
||||||
const questionsWithoutDefaults = questions.filter((q) => q.default === undefined || q.default === null || q.default === '');
|
const questionsWithoutDefaults = questions.filter((q) => q.default === undefined || q.default === null || q.default === '');
|
||||||
|
|
||||||
|
|
@ -621,8 +618,6 @@ class ConfigCollector {
|
||||||
allAnswers[question.name] = question.default;
|
allAnswers[question.name] = question.default;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Customize - ask all questions
|
|
||||||
console.log(chalk.dim(`\n Configuring ${moduleName.toUpperCase()}...`));
|
|
||||||
const promptedAnswers = await inquirer.prompt(questions);
|
const promptedAnswers = await inquirer.prompt(questions);
|
||||||
Object.assign(allAnswers, promptedAnswers);
|
Object.assign(allAnswers, promptedAnswers);
|
||||||
}
|
}
|
||||||
|
|
@ -647,8 +642,6 @@ class ConfigCollector {
|
||||||
|
|
||||||
// For arrays (multi-select), handle differently
|
// For arrays (multi-select), handle differently
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
// If there's a result template and it's a string, don't use it for arrays
|
|
||||||
// Just use the array value directly
|
|
||||||
result = value;
|
result = value;
|
||||||
} else if (item.result) {
|
} else if (item.result) {
|
||||||
result = item.result;
|
result = item.result;
|
||||||
|
|
@ -663,11 +656,9 @@ class ConfigCollector {
|
||||||
if (result === '{value}') {
|
if (result === '{value}') {
|
||||||
result = value;
|
result = value;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise replace in the string
|
|
||||||
result = result.replace('{value}', value);
|
result = result.replace('{value}', value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// For non-string values, use directly
|
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -719,7 +710,6 @@ class ConfigCollector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No result template, use value directly
|
|
||||||
result = value;
|
result = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue