ante-erp-cli 1.11.32 → 1.11.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/install.js +86 -98
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -139,122 +139,110 @@ export async function install(options) {
|
|
|
139
139
|
|
|
140
140
|
// Check if already installed
|
|
141
141
|
const existing = detectInstallation();
|
|
142
|
-
if (existing
|
|
142
|
+
if (existing) {
|
|
143
143
|
console.log(chalk.yellow('\n⚠ ANTE is already installed\n'));
|
|
144
144
|
console.log(chalk.gray('Installation directory: ') + chalk.white(existing));
|
|
145
|
-
console.log(chalk.cyan('\n📋 What you can do:\n'));
|
|
146
|
-
console.log(chalk.gray(' • Update existing installation: ') + chalk.white('ante update'));
|
|
147
|
-
console.log(chalk.gray(' • Check current status: ') + chalk.white('ante status'));
|
|
148
|
-
console.log(chalk.gray(' • Force reinstall (dangerous): ') + chalk.white('ante install --force'));
|
|
149
|
-
console.log(chalk.gray('\nTo completely remove and reinstall:'));
|
|
150
|
-
console.log(chalk.gray(' ') + chalk.white('ante uninstall --force && ante install\n'));
|
|
151
|
-
console.error(chalk.red('✗ Installation aborted to prevent data loss.\n'));
|
|
152
|
-
process.exit(1);
|
|
153
|
-
}
|
|
154
145
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
return 'You must type the exact phrase to continue';
|
|
146
|
+
// Ask user what they want to do
|
|
147
|
+
const { existingAction } = await inquirer.prompt([
|
|
148
|
+
{
|
|
149
|
+
type: 'list',
|
|
150
|
+
name: 'existingAction',
|
|
151
|
+
message: 'What would you like to do?',
|
|
152
|
+
choices: [
|
|
153
|
+
{
|
|
154
|
+
name: 'Reinstall (clean) - Remove all data and start fresh',
|
|
155
|
+
value: 'reinstall-clean'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'Reinstall (keep data) - Keep existing database data',
|
|
159
|
+
value: 'reinstall-keep'
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'Update - Update to latest version (recommended)',
|
|
163
|
+
value: 'update'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: 'Cancel - Exit without changes',
|
|
167
|
+
value: 'cancel'
|
|
179
168
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (confirmReinstall !== 'reinstall-and-reset-credentials') {
|
|
184
|
-
console.error(chalk.red('\n✗ Installation cancelled.\n'));
|
|
185
|
-
process.exit(1);
|
|
169
|
+
],
|
|
170
|
+
default: 'reinstall-clean'
|
|
186
171
|
}
|
|
172
|
+
]);
|
|
187
173
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
if (existingAction === 'cancel') {
|
|
175
|
+
console.log(chalk.yellow('\nInstallation cancelled.\n'));
|
|
176
|
+
process.exit(0);
|
|
191
177
|
}
|
|
192
178
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
179
|
+
if (existingAction === 'update') {
|
|
180
|
+
console.log(chalk.cyan('\nTo update, run: ') + chalk.white('ante update\n'));
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Handle reinstall options
|
|
185
|
+
if (existingAction === 'reinstall-clean') {
|
|
186
|
+
// Require confirmation for destructive action
|
|
187
|
+
console.log(chalk.red('\n⚠️ WARNING: This will permanently delete all data!'));
|
|
188
|
+
console.log(chalk.yellow(' • PostgreSQL database'));
|
|
189
|
+
console.log(chalk.yellow(' • MongoDB database'));
|
|
190
|
+
console.log(chalk.yellow(' • Redis cache'));
|
|
191
|
+
console.log(chalk.yellow(' • Uploaded files\n'));
|
|
197
192
|
|
|
198
|
-
const {
|
|
193
|
+
const { confirmDelete } = await inquirer.prompt([
|
|
199
194
|
{
|
|
200
|
-
type: '
|
|
201
|
-
name: '
|
|
202
|
-
message: '
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
name: 'Keep existing data (may cause issues if credentials changed)',
|
|
210
|
-
value: 'keep'
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: 'Cancel installation',
|
|
214
|
-
value: 'cancel'
|
|
215
|
-
}
|
|
216
|
-
],
|
|
217
|
-
default: 'clean'
|
|
195
|
+
type: 'input',
|
|
196
|
+
name: 'confirmDelete',
|
|
197
|
+
message: chalk.red('Type "DELETE ALL DATA" to confirm:'),
|
|
198
|
+
validate: (input) => {
|
|
199
|
+
if (input === 'DELETE ALL DATA') return true;
|
|
200
|
+
return 'You must type the exact phrase to continue';
|
|
201
|
+
}
|
|
218
202
|
}
|
|
219
203
|
]);
|
|
220
204
|
|
|
221
|
-
if (
|
|
205
|
+
if (confirmDelete !== 'DELETE ALL DATA') {
|
|
222
206
|
console.log(chalk.yellow('\nInstallation cancelled.\n'));
|
|
223
207
|
process.exit(0);
|
|
224
208
|
}
|
|
225
209
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
console.log(chalk.yellow('
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
type: 'input',
|
|
237
|
-
name: 'confirmDelete',
|
|
238
|
-
message: chalk.red('Type "DELETE ALL DATA" to confirm:'),
|
|
239
|
-
validate: (input) => {
|
|
240
|
-
if (input === 'DELETE ALL DATA') return true;
|
|
241
|
-
return 'You must type the exact phrase to continue';
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
]);
|
|
245
|
-
|
|
246
|
-
if (confirmDelete === 'DELETE ALL DATA') {
|
|
247
|
-
console.log(chalk.yellow('\nStopping services and removing volumes...'));
|
|
248
|
-
try {
|
|
249
|
-
await downServices(composeFile, true); // true = remove volumes
|
|
250
|
-
console.log(chalk.green('✓ Cleanup complete\n'));
|
|
251
|
-
} catch (error) {
|
|
252
|
-
console.log(chalk.yellow(`⚠ Cleanup warning: ${error.message}`));
|
|
253
|
-
console.log(chalk.gray('Continuing with installation...\n'));
|
|
254
|
-
}
|
|
210
|
+
// Stop services and remove volumes
|
|
211
|
+
const composeFile = join(existing, 'docker-compose.yml');
|
|
212
|
+
if (existsSync(composeFile)) {
|
|
213
|
+
console.log(chalk.yellow('\nStopping services and removing volumes...'));
|
|
214
|
+
try {
|
|
215
|
+
await downServices(composeFile, true); // true = remove volumes
|
|
216
|
+
console.log(chalk.green('✓ Cleanup complete\n'));
|
|
217
|
+
} catch (error) {
|
|
218
|
+
console.log(chalk.yellow(`⚠ Cleanup warning: ${error.message}`));
|
|
219
|
+
console.log(chalk.gray('Continuing with installation...\n'));
|
|
255
220
|
}
|
|
256
|
-
}
|
|
257
|
-
|
|
221
|
+
}
|
|
222
|
+
} else if (existingAction === 'reinstall-keep') {
|
|
223
|
+
console.log(chalk.yellow('\n⚠ Keeping existing data.'));
|
|
224
|
+
console.log(chalk.yellow(' If installation fails due to credential mismatch, reinstall with cleanup.\n'));
|
|
225
|
+
|
|
226
|
+
// Stop services but keep volumes
|
|
227
|
+
const composeFile = join(existing, 'docker-compose.yml');
|
|
228
|
+
if (existsSync(composeFile)) {
|
|
229
|
+
console.log(chalk.yellow('Stopping existing services...'));
|
|
230
|
+
try {
|
|
231
|
+
await downServices(composeFile, false); // false = keep volumes
|
|
232
|
+
console.log(chalk.green('✓ Services stopped\n'));
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.log(chalk.yellow(`⚠ Warning: ${error.message}`));
|
|
235
|
+
console.log(chalk.gray('Continuing with installation...\n'));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Backup existing .env
|
|
241
|
+
const envPath = join(existing, '.env');
|
|
242
|
+
if (existsSync(envPath)) {
|
|
243
|
+
const backupPath = backupEnvFile(envPath);
|
|
244
|
+
if (backupPath) {
|
|
245
|
+
console.log(chalk.yellow(`⚠ Existing config backed up: ${backupPath}\n`));
|
|
258
246
|
}
|
|
259
247
|
}
|
|
260
248
|
}
|