gdrive-syncer 3.1.1 → 3.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/envSync.js +13 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdrive-syncer",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Google Drive Syncer",
5
5
  "main": "./index.js",
6
6
  "bin": "./run.js",
package/src/envSync.js CHANGED
@@ -1519,11 +1519,13 @@ const runSyncOperation = async (syncConfig, action, projectRoot, backupPath, con
1519
1519
  }
1520
1520
 
1521
1521
  const downloadSpinner = spinner();
1522
- downloadSpinner.start('Downloading files...');
1523
-
1522
+ const totalToDownload = changes.modified.length + changes.driveOnly.length;
1524
1523
  let downloaded = 0;
1525
1524
 
1525
+ downloadSpinner.start(`Downloading files... (0/${totalToDownload})`);
1526
+
1526
1527
  for (const relativePath of changes.modified) {
1528
+ downloadSpinner.message(`Downloading (${downloaded + 1}/${totalToDownload}): ${relativePath}`);
1527
1529
  const srcPath = path.join(tempDir, relativePath);
1528
1530
  const destPath = path.join(envDir, relativePath);
1529
1531
  fs.ensureDirSync(path.dirname(destPath));
@@ -1532,6 +1534,7 @@ const runSyncOperation = async (syncConfig, action, projectRoot, backupPath, con
1532
1534
  }
1533
1535
 
1534
1536
  for (const relativePath of changes.driveOnly) {
1537
+ downloadSpinner.message(`Downloading (${downloaded + 1}/${totalToDownload}): ${relativePath}`);
1535
1538
  const srcPath = path.join(tempDir, relativePath);
1536
1539
  const destPath = path.join(envDir, relativePath);
1537
1540
  fs.ensureDirSync(path.dirname(destPath));
@@ -1542,11 +1545,13 @@ const runSyncOperation = async (syncConfig, action, projectRoot, backupPath, con
1542
1545
  downloadSpinner.stop(color.green(`Downloaded ${downloaded} file(s)`));
1543
1546
  } else if (action === 'upload') {
1544
1547
  const uploadSpinner = spinner();
1545
- uploadSpinner.start('Uploading files...');
1546
-
1548
+ const totalToUpload = changes.modified.length + changes.localOnly.length;
1549
+ let completed = 0;
1547
1550
  let uploaded = 0;
1548
1551
  let replaced = 0;
1549
1552
 
1553
+ uploadSpinner.start(`Uploading files... (0/${totalToUpload})`);
1554
+
1550
1555
  // Build a map of relativePath -> driveFile for quick lookup
1551
1556
  const driveFileMap = new Map();
1552
1557
  for (const df of driveFiles) {
@@ -1554,14 +1559,17 @@ const runSyncOperation = async (syncConfig, action, projectRoot, backupPath, con
1554
1559
  }
1555
1560
 
1556
1561
  for (const relativePath of changes.modified) {
1562
+ uploadSpinner.message(`Replacing (${completed + 1}/${totalToUpload}): ${relativePath}`);
1557
1563
  const driveFile = driveFileMap.get(relativePath);
1558
1564
  if (driveFile) {
1559
1565
  gdrive.update(driveFile.id, path.join(envDir, relativePath));
1560
1566
  replaced++;
1567
+ completed++;
1561
1568
  }
1562
1569
  }
1563
1570
 
1564
1571
  for (const relativePath of changes.localOnly) {
1572
+ uploadSpinner.message(`Uploading (${completed + 1}/${totalToUpload}): ${relativePath}`);
1565
1573
  const localFilePath = path.join(envDir, relativePath);
1566
1574
  const folderPath = path.dirname(relativePath);
1567
1575
 
@@ -1573,6 +1581,7 @@ const runSyncOperation = async (syncConfig, action, projectRoot, backupPath, con
1573
1581
 
1574
1582
  gdrive.upload(localFilePath, { parent: parentId });
1575
1583
  uploaded++;
1584
+ completed++;
1576
1585
  }
1577
1586
 
1578
1587
  uploadSpinner.stop(color.green(`Replaced: ${replaced}, New: ${uploaded}`));