fix(core): Implemented, fixes #1

This commit is contained in:
2025-01-14 17:34:16 +01:00
parent 656f5b7dfb
commit f065ef0e94
13 changed files with 9880 additions and 123 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/beautyfiglet',
version: '1.0.4',
description: 'A Node.js module for creating figlet text displays.'
}

View File

@ -1,2 +1,6 @@
const removeme = {};
export { removeme };
import figlet, { type Fonts } from 'figlet';
export {
figlet,
type Fonts,
}

View File

@ -1,3 +1,46 @@
import * as plugins from './beautyfiglet.plugins';
import * as plugins from './beautyfiglet.plugins.js';
export let standardExport = 'Hi there! :) This is an exported string';
export class BeautyFiglet {
/**
* Render text with a specific figlet font.
* @param text - The text to render.
* @param font - The font to use (optional).
* @returns A promise that resolves to the rendered ASCII art.
*/
static async renderText(text: string, font: plugins.figlet.Fonts = "Standard"): Promise<string> {
return new Promise((resolve, reject) => {
plugins.figlet.text(text, { font }, (err, result) => {
if (err) {
reject(`Error rendering text: ${err.message}`);
} else {
resolve(result || "");
}
});
});
}
/**
* Get a list of all available fonts in figlet.
* @returns A promise that resolves to an array of font names.
*/
static async listFonts(): Promise<string[]> {
return new Promise((resolve, reject) => {
plugins.figlet.fonts((err, fonts) => {
if (err) {
reject(`Error fetching fonts: ${err.message}`);
} else {
resolve(fonts || []);
}
});
});
}
/**
* Render text with a default font (Standard).
* @param text - The text to render.
* @returns A promise that resolves to the rendered ASCII art.
*/
static async renderDefault(text: string): Promise<string> {
return this.renderText(text, "Standard");
}
}