From 510293049fe8f4738c13a556f502ab1569714116 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Mon, 10 Jun 2024 17:00:47 +0200 Subject: [PATCH] feat: Improve console output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make output more consistent. * Show shorter, relative destination path. * Don’t start with a finish flag. :-) --- src/lib/Pipeline.class.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/Pipeline.class.ts b/src/lib/Pipeline.class.ts index 80f1775..1b1aeea 100644 --- a/src/lib/Pipeline.class.ts +++ b/src/lib/Pipeline.class.ts @@ -119,9 +119,9 @@ class Pipeline { this.startTime = performance.now(); if (!(this.opts?.silent === true)) console.info( - chalk.cyan(`🏁 starting pipeline "${chalk.bold(this.name)}"`) + chalk.cyan(`β–Ά Starting pipeline β€œ${chalk.bold(this.name)}”`) ); - spinner = ora('validating pipeline'); + spinner = ora('Validating pipeline'); if (!(this.opts?.silent === true)) spinner.start(); let startFromStage = 0; try { @@ -203,11 +203,11 @@ class Pipeline { stage.on('end', (iris, statements) => { if (!(this.opts?.silent === true)) spinner.succeed( - `stage "${chalk.bold( + `Stage β€œ${chalk.bold( stage.name - )}" resulted in ${statements.toLocaleString()} statement${ + )}” resulted in ${statements.toLocaleString()} statement${ statements === 1 ? '' : 's' - } in ${iris.toLocaleString()} iteration${iris === 1 ? '' : 's'}.` + } in ${iris.toLocaleString()} iteration${iris === 1 ? '' : 's'} (took ${prettyMilliseconds(performance.now() - startTime)})` ); resolve(); }); @@ -229,11 +229,11 @@ class Pipeline { if (!(this.opts?.silent === true)) console.info( chalk.green( - `βœ” your pipeline "${chalk.bold( + `βœ” Your pipeline β€œ${chalk.bold( this.name - )}" was completed in ${prettyMilliseconds( + )}” was completed in ${prettyMilliseconds( performance.now() - this.startTime - )} using ${memoryConsumption()} MB of memory.` + )} using ${memoryConsumption()} MB of memory` ) ); } @@ -243,7 +243,7 @@ class Pipeline { if (!(this.opts?.silent === true)) spinner.start(); await this.destination.write(this, spinner); if (!(this.opts?.silent === true)) - spinner.suffixText = this.destination.path; + spinner.suffixText = `${chalk.bold(path.relative(process.cwd(), this.destination.path))}`; if (!(this.opts?.silent === true)) spinner.succeed(); } @@ -265,7 +265,7 @@ class Pipeline { return; } - spinner.text = `Running ${stage.name}:\n\n Processed elements: ${millify( + spinner.text = `Running stage β€œ${chalk.bold(stage.name)}”:\n\n Processed elements: ${millify( iterationsProcessed )}\n Generated quads: ${millify( quadsGenerated