Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oclif/multi-stage-output

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/multi-stage-output - npm Package Compare versions

Comparing version 0.5.4 to 0.5.5

35

lib/components/stages.js

@@ -5,2 +5,3 @@ import { getLogger } from '@oclif/core/logger';

import React from 'react';
import wrapAnsi from 'wrap-ansi';
import { constructDesignParams } from '../design.js';

@@ -126,7 +127,5 @@ import { Divider } from './divider.js';

const estimatedTimeLength = 11;
const calculateWrappedHeight = (length) => {
if (length > columns) {
return Math.ceil(length / columns);
}
return 1;
const calculateWrappedHeight = (text) => {
const wrapped = wrapAnsi(text, columns, { hard: true, trim: false, wordWrap: true });
return wrapped.split('\n').length;
};

@@ -142,3 +141,3 @@ const calculateHeightOfBlock = (block) => {

// if the message is longer than the terminal width, add the number of lines
return acc + calculateWrappedHeight(info.value.length);
return acc + calculateWrappedHeight(info.value);
}

@@ -155,3 +154,3 @@ // if the message is multiline, add the number of lines

// if the value is longer than the terminal width, add the number of lines
return acc + calculateWrappedHeight(totalLength);
return acc + calculateWrappedHeight(`${label}: ${value}`);
}

@@ -165,9 +164,11 @@ return acc + value.split('\n').length;

const stageTimeLength = hasStageTime ? estimatedTimeLength : 0;
const totalLength = design.icons[status].paddingLeft +
design.icons[status].figure.length +
design.icons[status].paddingRight +
stage.length +
skipped.length +
stageTimeLength;
return calculateWrappedHeight(totalLength);
const parts = [
' '.repeat(design.icons[status].paddingLeft),
design.icons[status].figure,
' '.repeat(design.icons[status].paddingRight),
stage,
skipped,
'0'.repeat(stageTimeLength),
];
return calculateWrappedHeight(parts.join(''));
};

@@ -201,4 +202,6 @@ const calculateWidthOfCompactStage = (stage) => {

const paddings = 3 + (preStagesBlock ? 1 : 0) + (postStagesBlock ? 1 : 0) + (title ? 1 : 0);
const elapsedTimeHeight = hasElapsedTime ? calculateWrappedHeight('Elapsed Time:'.length + estimatedTimeLength) : 0;
const titleHeight = title ? calculateWrappedHeight(title.length) : 0;
const elapsedTimeHeight = hasElapsedTime
? calculateWrappedHeight(`Elapsed Time:${'0'.repeat(estimatedTimeLength)}`)
: 0;
const titleHeight = title ? calculateWrappedHeight(title) : 0;
const totalHeight = stagesHeight +

@@ -205,0 +208,0 @@ preStagesBlockHeight +

{
"name": "@oclif/multi-stage-output",
"description": "Terminal output for oclif commands with multiple stages",
"version": "0.5.4",
"version": "0.5.5",
"author": "Salesforce",

@@ -14,3 +14,4 @@ "bugs": "https://github.com/oclif/multi-stage-output/issues",

"ink": "^5.0.1",
"react": "^18.3.1"
"react": "^18.3.1",
"wrap-ansi": "^9.0.0"
},

@@ -17,0 +18,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc