fix(core): Implemented, fixes #1
This commit is contained in:
parent
656f5b7dfb
commit
f065ef0e94
@ -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
24
changelog.md
Normal 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
|
2
dist/beautyfiglet.plugins.d.ts
vendored
2
dist/beautyfiglet.plugins.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
declare const removeme: {};
|
|
||||||
export { removeme };
|
|
5
dist/beautyfiglet.plugins.js
vendored
5
dist/beautyfiglet.plugins.js
vendored
@ -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
1
dist/index.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export declare let standardExport: string;
|
|
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -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
19
license
Normal 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.
|
23
package.json
23
package.json
@ -2,15 +2,19 @@
|
|||||||
"name": "@push.rocks/beautyfiglet",
|
"name": "@push.rocks/beautyfiglet",
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"description": "A Node.js module for creating figlet text displays.",
|
"description": "A Node.js module for creating figlet text displays.",
|
||||||
"main": "dist/index.js",
|
"exports": {
|
||||||
"typings": "dist/index.d.ts",
|
".": "./dist_ts/index.js"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)",
|
"test": "(tstest test/)",
|
||||||
"format": "(gitzone format)"
|
"format": "(gitzone format)"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"dependencies": {
|
||||||
"dependencies": {},
|
"@types/figlet": "^1.7.0",
|
||||||
|
"figlet": "^1.8.0"
|
||||||
|
},
|
||||||
"homepage": "https://code.foss.global/push.rocks/beautyfiglet",
|
"homepage": "https://code.foss.global/push.rocks/beautyfiglet",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -22,5 +26,12 @@
|
|||||||
"Node.js",
|
"Node.js",
|
||||||
"npm module",
|
"npm module",
|
||||||
"typescript"
|
"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
9734
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
33
test/test.ts
33
test/test.ts
@ -1,8 +1,31 @@
|
|||||||
import { expect, tap } from 'tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as beautyfiglet from '../ts/index';
|
import * as beautyfiglet from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('first test', async () => {
|
let testFiglet: typeof beautyfiglet.BeautyFiglet;
|
||||||
console.log(beautyfiglet.standardExport);
|
|
||||||
|
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
8
ts/00_commitinfo_data.ts
Normal 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.'
|
||||||
|
}
|
@ -1,2 +1,6 @@
|
|||||||
const removeme = {};
|
import figlet, { type Fonts } from 'figlet';
|
||||||
export { removeme };
|
|
||||||
|
export {
|
||||||
|
figlet,
|
||||||
|
type Fonts,
|
||||||
|
}
|
47
ts/index.ts
47
ts/index.ts
@ -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");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user