@automattic/vip 3.23.2 → 3.23.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.
@@ -131,6 +131,7 @@ Are you sure you want to import the contents of the URL?
131
131
  sourceIsLocal = true;
132
132
  const fileMeta = await (0, _clientFileUploader.getFileMeta)(fileNameOrURL);
133
133
  fileMeta.fileName = fileNameOrURL;
134
+ let lastProgress = '';
134
135
  const {
135
136
  fileMeta: {
136
137
  basename
@@ -141,8 +142,15 @@ Are you sure you want to import the contents of the URL?
141
142
  app,
142
143
  env,
143
144
  fileMeta,
144
- progressCallback: percentage => console.log(`Upload progress: ${percentage}%`)
145
+ progressCallback: percentage => {
146
+ if (percentage === lastProgress) {
147
+ return;
148
+ }
149
+ lastProgress = percentage;
150
+ process.stdout.write(`\rUpload progress: ${percentage} `);
151
+ }
145
152
  });
153
+ process.stdout.write('\n');
146
154
 
147
155
  // small debug info to keep variables used
148
156
  debug('Uploaded file basename:', basename);
@@ -440,30 +440,39 @@ _args.default.argv = async function (argv, cb) {
440
440
  break;
441
441
  }
442
442
  case 'import-media':
443
- info.push({
444
- key: 'Archive URL',
445
- value: _chalk.default.blue.underline(this.sub)
446
- });
447
- options.overwriteExistingFiles = Object.hasOwn(options, 'overwriteExistingFiles') && Boolean(options.overwriteExistingFiles) && !['false', 'no'].includes(options.overwriteExistingFiles);
448
- info.push({
449
- key: 'Overwrite any existing files',
450
- value: options.overwriteExistingFiles ? '✅ Yes' : `${_chalk.default.red('x')} No`
451
- });
452
- options.importIntermediateImages = Object.hasOwn(options, 'importIntermediateImages') && Boolean(options.importIntermediateImages) && !['false', 'no'].includes(options.importIntermediateImages);
453
- info.push({
454
- key: 'Import intermediate image files',
455
- value: options.importIntermediateImages ? '✅ Yes' : `${_chalk.default.red('x')} No`
456
- });
457
- options.exportFileErrorsToJson = Object.hasOwn(options, 'exportFileErrorsToJson') && Boolean(options.exportFileErrorsToJson) && !['false', 'no'].includes(options.exportFileErrorsToJson);
458
- info.push({
459
- key: 'Export any file errors encountered to a JSON file instead of a plain text file.',
460
- value: options.exportFileErrorsToJson ? '✅ Yes' : `${_chalk.default.red('x')} No`
461
- });
462
- info.push({
463
- key: 'Download file-error logs?',
464
- value: options.saveErrorLog
465
- });
466
- break;
443
+ {
444
+ const isUrl = this.sub && (String(this.sub).startsWith('http://') || String(this.sub).startsWith('https://'));
445
+ const archiveLabel = isUrl ? 'Archive URL' : 'Archive Path';
446
+ info.push({
447
+ key: archiveLabel,
448
+ value: _chalk.default.blue.underline(this.sub)
449
+ });
450
+
451
+ // Update confirmation message if it's a local path
452
+ if (!isUrl && 'string' === typeof _opts.requireConfirm) {
453
+ message = message.replaceAll('the URL', 'the path');
454
+ }
455
+ options.overwriteExistingFiles = Object.hasOwn(options, 'overwriteExistingFiles') && Boolean(options.overwriteExistingFiles) && !['false', 'no'].includes(options.overwriteExistingFiles);
456
+ info.push({
457
+ key: 'Overwrite any existing files',
458
+ value: options.overwriteExistingFiles ? '✅ Yes' : `${_chalk.default.red('x')} No`
459
+ });
460
+ options.importIntermediateImages = Object.hasOwn(options, 'importIntermediateImages') && Boolean(options.importIntermediateImages) && !['false', 'no'].includes(options.importIntermediateImages);
461
+ info.push({
462
+ key: 'Import intermediate image files',
463
+ value: options.importIntermediateImages ? ' Yes' : `${_chalk.default.red('x')} No`
464
+ });
465
+ options.exportFileErrorsToJson = Object.hasOwn(options, 'exportFileErrorsToJson') && Boolean(options.exportFileErrorsToJson) && !['false', 'no'].includes(options.exportFileErrorsToJson);
466
+ info.push({
467
+ key: 'Export any file errors encountered to a JSON file instead of a plain text file.',
468
+ value: options.exportFileErrorsToJson ? '✅ Yes' : `${_chalk.default.red('x')} No`
469
+ });
470
+ info.push({
471
+ key: 'Download file-error logs?',
472
+ value: options.saveErrorLog
473
+ });
474
+ break;
475
+ }
467
476
  default:
468
477
  }
469
478
  const skipPrompt = _opts.skipConfirmPrompt || false;