servicemap 0.1.14 → 0.1.15

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/bin/servicemap.mjs +25 -2
  2. package/package.json +1 -1
@@ -475,6 +475,29 @@ function runSilent(command, args, options = {}) {
475
475
  });
476
476
  }
477
477
 
478
+ async function withSpinner(message, action) {
479
+ if (!process.stdout.isTTY) {
480
+ return action();
481
+ }
482
+
483
+ const frames = ['◒', '◐', '◓', '◑'];
484
+ let frame = 0;
485
+ let dots = '';
486
+ process.stdout.write('\x1b[?25l');
487
+ const interval = setInterval(() => {
488
+ process.stdout.write(`\r\x1b[J${frames[frame]} ${message}${dots}`);
489
+ frame = (frame + 1) % frames.length;
490
+ if (frame === 0) dots = dots.length >= 5 ? '' : `${dots}.`;
491
+ }, 120);
492
+
493
+ try {
494
+ return await action();
495
+ } finally {
496
+ clearInterval(interval);
497
+ process.stdout.write('\r\x1b[J\x1b[?25h');
498
+ }
499
+ }
500
+
478
501
  async function prepareStableSource(options) {
479
502
  const sourceRoot = stableSourceRoot();
480
503
  if (options.dryRun) {
@@ -487,11 +510,11 @@ async function prepareStableSource(options) {
487
510
 
488
511
  try {
489
512
  if (existsSync(join(sourceRoot, '.git'))) {
490
- await runSilent('git', ['pull', '--ff-only'], { cwd: sourceRoot });
513
+ await withSpinner('Updating repository…', () => runSilent('git', ['pull', '--ff-only'], { cwd: sourceRoot }));
491
514
  timelineStep('Repository updated');
492
515
  } else {
493
516
  await rm(sourceRoot, { recursive: true, force: true });
494
- await runSilent('git', ['clone', '--depth', '1', repositoryUrl, sourceRoot]);
517
+ await withSpinner('Cloning repository…', () => runSilent('git', ['clone', '--depth', '1', repositoryUrl, sourceRoot]));
495
518
  timelineStep('Repository cloned');
496
519
  }
497
520
  } catch (_error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "servicemap",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Generate an internal service map page or desktop app for a software project.",
5
5
  "type": "module",
6
6
  "bin": {