ante-erp-cli 1.11.1 → 1.11.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ante-erp-cli",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "description": "Comprehensive CLI tool for managing ANTE ERP self-hosted installations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -251,40 +251,22 @@ export async function cloneDb(sourceUrl, options = {}) {
251
251
  }
252
252
  console.log('');
253
253
 
254
- // Track Prisma operation results
255
- let generateSuccess = false;
254
+ // Track Prisma migration result
256
255
  let migrateSuccess = false;
257
256
 
258
- // Step 7: Run Prisma operations (if not skipped)
257
+ // Step 7: Run Prisma migrations (if not skipped)
259
258
  if (!options.noPrisma) {
260
- console.log(chalk.yellow('Step 7/7: Running Prisma operations...'));
259
+ console.log(chalk.yellow('Step 7/7: Running Prisma migrations...'));
261
260
 
262
- // Generate Prisma client
263
- const generateSpinner = ora('Generating Prisma client...').start();
264
- const generateStartTime = Date.now();
265
- try {
266
- await execInContainer(
267
- composeFile,
268
- 'backend',
269
- ['npx', 'prisma', 'generate']
270
- );
271
- const generateDuration = ((Date.now() - generateStartTime) / 1000).toFixed(1);
272
- generateSpinner.succeed(chalk.green(`Prisma client generated (${generateDuration}s)`));
273
- generateSuccess = true;
274
- } catch (error) {
275
- generateSpinner.fail(chalk.red('Prisma generate failed'));
276
- console.log(chalk.yellow(' Warning: You may need to run "npx prisma generate" manually in the backend container'));
277
- console.log(chalk.gray(` Error: ${error.message}`));
278
- }
279
-
280
- // Run Prisma migrations
281
- const migrateSpinner = ora('Running Prisma migrations...').start();
261
+ // Run Prisma migrations with timeout
262
+ const migrateSpinner = ora('Applying Prisma migrations...').start();
282
263
  const migrateStartTime = Date.now();
283
264
  try {
284
265
  await execInContainer(
285
266
  composeFile,
286
267
  'backend',
287
- ['npx', 'prisma', 'migrate', 'deploy']
268
+ ['npx', 'prisma', 'migrate', 'deploy'],
269
+ { timeout: 180000 } // 3 minutes timeout
288
270
  );
289
271
  const migrateDuration = ((Date.now() - migrateStartTime) / 1000).toFixed(1);
290
272
  migrateSpinner.succeed(chalk.green(`Prisma migrations completed (${migrateDuration}s)`));
@@ -316,13 +298,6 @@ export async function cloneDb(sourceUrl, options = {}) {
316
298
  }
317
299
 
318
300
  if (!options.noPrisma) {
319
- // Show Prisma generate status
320
- if (generateSuccess) {
321
- console.log(chalk.gray(' ✓ Prisma client generated'));
322
- } else {
323
- console.log(chalk.yellow(' ⚠ Prisma client generation failed - run manually if needed'));
324
- }
325
-
326
301
  // Show Prisma migrate status
327
302
  if (migrateSuccess) {
328
303
  console.log(chalk.gray(' ✓ Prisma migrations applied'));
@@ -140,9 +140,11 @@ export async function getLogs(composeFile, service, options = {}) {
140
140
  * @param {string} composeFile - Path to docker-compose.yml
141
141
  * @param {string} service - Service name
142
142
  * @param {string[]} command - Command to execute
143
+ * @param {Object} options - Optional execution options
144
+ * @param {number} options.timeout - Timeout in milliseconds (default: no timeout)
143
145
  * @returns {Promise<string>}
144
146
  */
145
- export async function execInContainer(composeFile, service, command) {
147
+ export async function execInContainer(composeFile, service, command, options = {}) {
146
148
  const { stdout } = await execa('docker', [
147
149
  'compose',
148
150
  '-f',
@@ -151,8 +153,10 @@ export async function execInContainer(composeFile, service, command) {
151
153
  '-T',
152
154
  service,
153
155
  ...command
154
- ]);
155
-
156
+ ], {
157
+ timeout: options.timeout
158
+ });
159
+
156
160
  return stdout;
157
161
  }
158
162
 
@@ -84,7 +84,7 @@ export async function testConnection(connectionInfo, composeFile = null) {
84
84
  '-f', composeFile,
85
85
  'exec',
86
86
  '-T',
87
- 'mongo',
87
+ 'mongodb',
88
88
  'mongosh',
89
89
  mongoUrl,
90
90
  '--quiet',