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 (questions.length > 0) {
|
||||
// Get friendly module name from config or use uppercase module name
|
||||
const moduleDisplayName = moduleConfig.header || `${moduleName.toUpperCase()} Module`;
|
||||
|
||||
// Add blank line for better readability
|
||||
console.log();
|
||||
|
||||
// Display the module name in color first
|
||||
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
|
||||
const { customize } = await inquirer.prompt([
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'customize',
|
||||
message: 'Accept Defaults (no to customize)?',
|
||||
default: true,
|
||||
},
|
||||
]);
|
||||
|
||||
if (customize) {
|
||||
if (customize && moduleName !== 'core') {
|
||||
// Accept defaults - only ask questions that have NO default value
|
||||
const questionsWithoutDefaults = questions.filter((q) => q.default === undefined || q.default === null || q.default === '');
|
||||
|
||||
|
|
@ -621,8 +618,6 @@ class ConfigCollector {
|
|||
allAnswers[question.name] = question.default;
|
||||
}
|
||||
} else {
|
||||
// Customize - ask all questions
|
||||
console.log(chalk.dim(`\n Configuring ${moduleName.toUpperCase()}...`));
|
||||
const promptedAnswers = await inquirer.prompt(questions);
|
||||
Object.assign(allAnswers, promptedAnswers);
|
||||
}
|
||||
|
|
@ -647,8 +642,6 @@ class ConfigCollector {
|
|||
|
||||
// For arrays (multi-select), handle differently
|
||||
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;
|
||||
} else if (item.result) {
|
||||
result = item.result;
|
||||
|
|
@ -663,11 +656,9 @@ class ConfigCollector {
|
|||
if (result === '{value}') {
|
||||
result = value;
|
||||
} else {
|
||||
// Otherwise replace in the string
|
||||
result = result.replace('{value}', value);
|
||||
}
|
||||
} else {
|
||||
// For non-string values, use directly
|
||||
result = value;
|
||||
}
|
||||
|
||||
|
|
@ -719,7 +710,6 @@ class ConfigCollector {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
// No result template, use value directly
|
||||
result = value;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue