fix(core): Implemented, fixes #1

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

View File

@ -1,95 +0,0 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
snyk:
stage: security
script:
- npmci command yarn global add snyk
- npmci command yarn install --ignore-scripts
- npmci command snyk test
tags:
- docker
testLEGACY:
stage: test
script:
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci npm prepare
- npmci npm publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker
pages:
image: hosttoday/ht-docker-node:npmci
stage: pages
script:
- npmci command yarn global add npmpage
- npmci command npmpage
tags:
- docker
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public

24
changelog.md Normal file
View File

@ -0,0 +1,24 @@
# Changelog
## 2025-01-14 - 1.0.4 - fix(core)
Removed unnecessary files and updated dependencies
- Removed .gitlab-ci.yml to streamline the CI/CD process
- Updated and fixed TypeScript files to align with ES Module syntax
- Removed obsolete dist files for a cleaner build
- Updated package.json to reflect current project configurations, including dependencies and scripts
## 2024-05-29 - 1.0.3 - Enhancements
Finalizing updates under version 1.0.3
- Updated project description
## 2023-07-10 to 2024-05-29 - 1.0.3 - Organizational Changes
Implemented significant organizational changes
- Switched to a new organizational scheme
## 2018-03-05 - 1.0.2 to 1.0.3 - Maintenance and Format Updates
Streamlined maintenance and formatting
- Updated code formatting for consistency

View File

@ -1,2 +0,0 @@
declare const removeme: {};
export { removeme };

View File

@ -1,5 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const removeme = {};
exports.removeme = removeme;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5ZmlnbGV0LnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlmaWdsZXQucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLE1BQU0sUUFBUSxHQUFHLEVBQUUsQ0FBQztBQUVsQiw0QkFBUSJ9

1
dist/index.d.ts vendored
View File

@ -1 +0,0 @@
export declare let standardExport: string;

4
dist/index.js vendored
View File

@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.standardExport = 'Hi there! :) This is an exported string';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVXLFFBQUEsY0FBYyxHQUFHLHlDQUF5QyxDQUFDIn0=

19
license Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2014 Task Venture Capital GmbH (hello@lossless.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -2,15 +2,19 @@
"name": "@push.rocks/beautyfiglet",
"version": "1.0.3",
"description": "A Node.js module for creating figlet text displays.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": "./dist_ts/index.js"
},
"type": "module",
"author": "Lossless GmbH",
"scripts": {
"test": "(npmts)",
"test": "(tstest test/)",
"format": "(gitzone format)"
},
"devDependencies": {},
"dependencies": {},
"dependencies": {
"@types/figlet": "^1.7.0",
"figlet": "^1.8.0"
},
"homepage": "https://code.foss.global/push.rocks/beautyfiglet",
"repository": {
"type": "git",
@ -22,5 +26,12 @@
"Node.js",
"npm module",
"typescript"
]
],
"devDependencies": {
"@git.zone/tsbuild": "^2.2.0",
"@git.zone/tsbundle": "^2.1.0",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.5.4"
}
}

9734
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,31 @@
import { expect, tap } from 'tapbundle';
import * as beautyfiglet from '../ts/index';
import { expect, tap } from '@push.rocks/tapbundle';
import * as beautyfiglet from '../ts/index.js';
tap.test('first test', async () => {
console.log(beautyfiglet.standardExport);
let testFiglet: typeof beautyfiglet.BeautyFiglet;
tap.test('setup', async () => {
testFiglet = beautyfiglet.BeautyFiglet;
expect(testFiglet).toBeTruthy();
});
tap.start();
tap.test('should render text with the default font', async () => {
const text = "Hello, World!";
const result = await testFiglet.renderDefault(text);
expect(result).toBeTruthy();
});
tap.test('should render text with a specific font', async () => {
const text = "Fancy Text";
const font = "Ghost";
const result = await testFiglet.renderText(text, font);
expect(result).toBeTruthy();
});
tap.test('should list available fonts', async () => {
const fonts = await testFiglet.listFonts();
expect(Array.isArray(fonts)).toBeTrue();
expect(fonts.length).toBeGreaterThan(0);
expect(fonts).toContain("Standard"); // Ensure "Standard" is in the font list
});
tap.start();

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");
}
}