@oclif/multi-stage-output 0.7.6 → 0.7.7

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.
@@ -61,6 +61,7 @@ declare class CIMultiStageOutput<T extends Record<string, unknown>> {
61
61
  private readonly messageTimeout;
62
62
  private readonly postStagesBlock?;
63
63
  private readonly preStagesBlock?;
64
+ private readonly seenInfo;
64
65
  private readonly seenStages;
65
66
  private readonly stages;
66
67
  private readonly stageSpecificBlock?;
@@ -41,6 +41,7 @@ class CIMultiStageOutput {
41
41
  messageTimeout = Number.parseInt(env.SF_CI_MESSAGE_TIMEOUT ?? '5000', 10) ?? 5000;
42
42
  postStagesBlock;
43
43
  preStagesBlock;
44
+ seenInfo = new Set();
44
45
  seenStages = new Set();
45
46
  stages;
46
47
  stageSpecificBlock;
@@ -71,15 +72,15 @@ class CIMultiStageOutput {
71
72
  }
72
73
  stop(stageTracker) {
73
74
  this.update(stageTracker);
75
+ ux.stdout();
76
+ this.printInfo(this.preStagesBlock, 0, true);
77
+ this.printInfo(this.postStagesBlock, 0, true);
74
78
  if (this.startTime) {
75
79
  const elapsedTime = Date.now() - this.startTime;
76
80
  ux.stdout();
77
81
  const displayTime = readableTime(elapsedTime, this.timerUnit);
78
82
  ux.stdout(`Elapsed time: ${displayTime}`);
79
- ux.stdout();
80
83
  }
81
- this.printInfo(this.preStagesBlock);
82
- this.printInfo(this.postStagesBlock);
83
84
  }
84
85
  update(stageTracker, data) {
85
86
  this.data = { ...this.data, ...data };
@@ -137,19 +138,18 @@ class CIMultiStageOutput {
137
138
  }
138
139
  }
139
140
  }
140
- printInfo(infoBlock, indent = 0) {
141
+ printInfo(infoBlock, indent = 0, force = false) {
141
142
  const spaces = ' '.repeat(indent);
142
143
  if (infoBlock?.length) {
143
144
  for (const info of infoBlock) {
144
145
  const formattedData = info.get ? info.get(this.data) : undefined;
145
146
  if (!formattedData)
146
147
  continue;
147
- if (info.type === 'message') {
148
- ux.stdout(`${spaces}${formattedData}`);
149
- }
150
- else {
151
- ux.stdout(`${spaces}${info.label}: ${formattedData}`);
152
- }
148
+ const str = info.type === 'message' ? formattedData : `${info.label}: ${formattedData}`;
149
+ if (!force && this.seenInfo.has(str))
150
+ continue;
151
+ ux.stdout(`${spaces}${str}`);
152
+ this.seenInfo.add(str);
153
153
  }
154
154
  }
155
155
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/multi-stage-output",
3
3
  "description": "Terminal output for oclif commands with multiple stages",
4
- "version": "0.7.6",
4
+ "version": "0.7.7",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/multi-stage-output/issues",
7
7
  "dependencies": {
@@ -17,7 +17,7 @@
17
17
  "@commitlint/config-conventional": "^19",
18
18
  "@oclif/prettier-config": "^0.2.1",
19
19
  "@types/chai": "^4.3.16",
20
- "@types/mocha": "^10.0.8",
20
+ "@types/mocha": "^10.0.9",
21
21
  "@types/node": "^18",
22
22
  "@types/sinon": "^17.0.3",
23
23
  "chai": "^4.5.0",