fix: prevent double installation when updating v4
- Added flag to prevent installer.install() being called twice - Fixed undefined 'directory' error by using answers.directory - Update flow now completes without errors - Prevents 'Cannot read properties of undefined' error after successful update 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,9 @@ program
|
|||||||
if (!options.full && !options.agent && !options.team && !options.expansionOnly) {
|
if (!options.full && !options.agent && !options.team && !options.expansionOnly) {
|
||||||
// Interactive mode
|
// Interactive mode
|
||||||
const answers = await promptInstallation();
|
const answers = await promptInstallation();
|
||||||
await installer.install(answers);
|
if (!answers._alreadyInstalled) {
|
||||||
|
await installer.install(answers);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Direct mode
|
// Direct mode
|
||||||
let installType = 'full';
|
let installType = 'full';
|
||||||
@@ -181,7 +183,9 @@ async function promptInstallation() {
|
|||||||
if (shouldUpdate) {
|
if (shouldUpdate) {
|
||||||
// Skip other prompts and go directly to update
|
// Skip other prompts and go directly to update
|
||||||
answers.installType = 'update';
|
answers.installType = 'update';
|
||||||
return await installer.install(answers);
|
answers._alreadyInstalled = true; // Flag to prevent double installation
|
||||||
|
await installer.install(answers);
|
||||||
|
return answers; // Return the answers object
|
||||||
}
|
}
|
||||||
// If user doesn't want to update, continue with normal flow
|
// If user doesn't want to update, continue with normal flow
|
||||||
}
|
}
|
||||||
@@ -401,7 +405,7 @@ async function promptInstallation() {
|
|||||||
type: 'input',
|
type: 'input',
|
||||||
name: 'webBundlesDirectory',
|
name: 'webBundlesDirectory',
|
||||||
message: 'Enter directory for web bundles:',
|
message: 'Enter directory for web bundles:',
|
||||||
default: `${directory}/web-bundles`,
|
default: `${answers.directory}/web-bundles`,
|
||||||
validate: (input) => {
|
validate: (input) => {
|
||||||
if (!input.trim()) {
|
if (!input.trim()) {
|
||||||
return 'Please enter a valid directory path';
|
return 'Please enter a valid directory path';
|
||||||
|
|||||||
Reference in New Issue
Block a user