feat(installer): default project name to directory (#681)
This commit is contained in:
@@ -16,7 +16,7 @@ prompt:
|
||||
|
||||
project_name:
|
||||
prompt: "What is the title of your project you will be working on?"
|
||||
default: "My Project"
|
||||
default: "{directory_name}"
|
||||
result: "{value}"
|
||||
|
||||
tech_docs:
|
||||
|
||||
@@ -10,6 +10,7 @@ class ConfigCollector {
|
||||
constructor() {
|
||||
this.collectedConfig = {};
|
||||
this.existingConfig = null;
|
||||
this.currentProjectDir = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +94,7 @@ class ConfigCollector {
|
||||
* @param {boolean} skipCompletion - Skip showing completion message (for early core collection)
|
||||
*/
|
||||
async collectModuleConfig(moduleName, projectDir, skipLoadExisting = false, skipCompletion = false) {
|
||||
this.currentProjectDir = projectDir;
|
||||
// Load existing config if needed and not already loaded
|
||||
if (!skipLoadExisting && !this.existingConfig) {
|
||||
await this.loadExistingConfig(projectDir);
|
||||
@@ -281,6 +283,11 @@ class ConfigCollector {
|
||||
let defaultValue = item.default;
|
||||
let choices = null;
|
||||
|
||||
if (typeof defaultValue === 'string' && defaultValue.includes('{directory_name}') && this.currentProjectDir) {
|
||||
const dirName = path.basename(this.currentProjectDir);
|
||||
defaultValue = defaultValue.replaceAll('{directory_name}', dirName);
|
||||
}
|
||||
|
||||
// Handle different question types
|
||||
if (item['single-select']) {
|
||||
questionType = 'list';
|
||||
|
||||
Reference in New Issue
Block a user