smoonb 0.0.36 → 0.0.38

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": "smoonb",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "Complete Supabase backup and migration tool - EXPERIMENTAL VERSION - USE AT YOUR OWN RISK",
5
5
  "preferGlobal": false,
6
6
  "preventGlobalInstall": true,
@@ -425,41 +425,23 @@ async function backupEdgeFunctionsWithDocker(projectId, accessToken, backupDir)
425
425
 
426
426
  // Baixar Edge Function via Supabase CLI DIRETAMENTE para o backup
427
427
  const { execSync } = require('child_process');
428
- const tempBackupDir = path.join(backupDir, 'temp-supabase-download');
429
428
 
430
- // Criar estrutura temp para download sem contaminar ./supabase/
431
- await ensureDir(tempBackupDir);
432
-
433
- // Download para diretório temporário
429
+ // Download DIRETO para o diretório de destino (sem intermediários)
434
430
  execSync(`supabase functions download ${func.name}`, {
435
- cwd: tempBackupDir,
431
+ cwd: functionTargetDir,
436
432
  timeout: 60000,
437
433
  stdio: 'pipe'
438
434
  });
439
435
 
440
- // Mover de temp para o backup final
441
- const tempFunctionDir = path.join(tempBackupDir, 'supabase', 'functions', func.name);
436
+ console.log(chalk.green(` ✅ ${func.name} baixada com sucesso`));
437
+ successCount++;
442
438
 
443
- // Verificar se existe usando fs.promises.access
444
- try {
445
- await fs.access(tempFunctionDir);
446
- await copyDir(tempFunctionDir, functionTargetDir);
447
-
448
- // Limpar diretório temporário
449
- await fs.rm(tempBackupDir, { recursive: true, force: true }).catch(() => {});
450
-
451
- console.log(chalk.green(` ✅ ${func.name} baixada com sucesso`));
452
- successCount++;
453
-
454
- downloadedFunctions.push({
455
- name: func.name,
456
- slug: func.name,
457
- version: func.version || 'unknown',
458
- files: await fs.readdir(functionTargetDir).catch(() => [])
459
- });
460
- } else {
461
- throw new Error('Diretório não encontrado após download');
462
- }
439
+ downloadedFunctions.push({
440
+ name: func.name,
441
+ slug: func.name,
442
+ version: func.version || 'unknown',
443
+ files: await fs.readdir(functionTargetDir).catch(() => [])
444
+ });
463
445
 
464
446
  } catch (error) {
465
447
  console.log(chalk.yellow(` ⚠️ Erro ao baixar ${func.name}: ${error.message}`));