fix(source-interactive): Fix import path in receiver tests and rename progress bar property for clarity; update SmartlogSourceOra getter for improved backward compatibility.

This commit is contained in:
Philipp Kunz 2025-05-15 20:00:38 +00:00
parent 7e2f076b35
commit 13e1582732
4 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 2025-05-15 - 3.1.1 - fix(source-interactive)
Fix import path in receiver tests and rename progress bar property for clarity; update SmartlogSourceOra getter for improved backward compatibility.
- Changed test file import from '../ts/index.js' to '../dist_ts/index.js' in test.receiver.node.ts to resolve module path issues
- Renamed property 'complete' to 'completeChar' in SmartlogProgressBar and updated its usage accordingly
- Modified SmartlogSourceOra getter to use public methods for starting and stopping the spinner, ensuring backward compatibility
## 2025-05-15 - 3.1.0 - feat(interactive)
Add interactive console features and refactor spinner module by renaming source-ora to source-interactive and removing ora dependency

View File

@ -1,6 +1,6 @@
import { expect, tap } from '@push.rocks/tapbundle';
import { SmartlogReceiver } from '../ts_receiver/index.js';
import { Smartlog } from '../ts/index.js';
import { Smartlog } from '../dist_ts/index.js';
import * as smartlogInterfaces from '../ts_interfaces/index.js';
import * as smarthash from '@push.rocks/smarthash';

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartlog',
version: '3.1.0',
version: '3.1.1',
description: 'A minimalistic, distributed, and extensible logging tool supporting centralized log management.'
}

View File

@ -259,7 +259,7 @@ export class SmartlogProgressBar {
private total: number;
private current: number = 0;
private width: number;
private complete: string;
private completeChar: string;
private incomplete: string;
private renderThrottle: number;
private clear: boolean;
@ -276,7 +276,7 @@ export class SmartlogProgressBar {
constructor(options: IProgressBarOptions) {
this.total = options.total;
this.width = options.width || 30;
this.complete = options.complete || '█';
this.completeChar = options.complete || '█';
this.incomplete = options.incomplete || '░';
this.renderThrottle = options.renderThrottle || 16;
this.clear = options.clear !== undefined ? options.clear : false;
@ -369,7 +369,7 @@ export class SmartlogProgressBar {
const incompleteLength = this.width - completeLength;
// Build the progress bar
const completePart = colors[this.color] + this.complete.repeat(completeLength) + colors.reset;
const completePart = colors[this.color] + this.completeChar.repeat(completeLength) + colors.reset;
const incompletePart = this.incomplete.repeat(incompleteLength);
const progressBar = `[${completePart}${incompletePart}]`;
@ -400,12 +400,14 @@ export class SmartlogProgressBar {
export class SmartlogSourceOra extends SmartlogSourceInteractive {
// Add a stub for the oraInstance property for backward compatibility
public get oraInstance() {
// Use public methods instead of accessing private properties
const instance = this;
return {
text: this.textContent,
start: () => this.start(),
stop: () => this.stop(),
succeed: (text?: string) => this.finishSuccess(text),
fail: (text?: string) => this.finishFail(text)
get text() { return ''; }, // We can't access private textContent directly
start: () => instance.text(''), // This starts the spinner
stop: () => instance.stop(),
succeed: (text?: string) => instance.finishSuccess(text),
fail: (text?: string) => instance.finishFail(text)
};
}